https://medium.com/@nickhuang_1199/%E6%B7%B1%E5%BA%A6%E4%BA%86%E8%A7%A3%E5%9C%A8javascript%E4%B8%AD%E6%B7%BA%E6%8B%B7%E8%B2%9D-shallow-copy-vs-%E6%B7%B1%E5%BA%A6%E6%8B%B7%E8%B2%9D-deep-copy-%E5%BE%97%E9%83%A8%E5%88%86-33fe501871e
類似by value v.s. by reference的概念,專指在複製行為上
文章加密
;
2020年6月17日 星期三
2020年6月16日 星期二
小白也能看懂的Vuex 又 Vuex is different from store,使用带有 setter 的双向绑定计算属性應用到表單
https://zhuanlan.zhihu.com/p/80716895
Vuex is different from store:
應該說store是個變數,常用來存vuex整個寫好程式的,非vuex這個模組,而vuex本身其實不含那些我們添加的states, actions, ...
https://juejin.im/post/5d1f0947f265da1b667bfb41 State, mapState, ...mapState
https://vuex.vuejs.org/zh/guide/modules.html vuex的modules概念, action的參數怎麼會變,第一個是state還是dispatch...看不懂
https://vuex.vuejs.org/zh/guide/forms.html
假设这里的
較好的方法是使用带有 setter 的双向绑定计算属性,如下:
<input v-model="message">
//....
computed: {
message: {
get () {
return this.$store.state.obj.message
},
set (value) {
this.$store.commit('updateMessage', value)
}
}
}
Vuex is different from store:
應該說store是個變數,常用來存vuex整個寫好程式的,非vuex這個模組,而vuex本身其實不含那些我們添加的states, actions, ...
https://juejin.im/post/5d1f0947f265da1b667bfb41 State, mapState, ...mapState
https://vuex.vuejs.org/zh/guide/modules.html vuex的modules概念, action的參數怎麼會變,第一個是state還是dispatch...看不懂
https://vuex.vuejs.org/zh/guide/forms.html
假设这里的
obj 是在计算属性中返回的一个属于 Vuex store 的对象,在用户输入时,v-model 会试图直接修改 obj.message。在严格模式中,由于这个修改不是在 mutation 函数中执行的, 这里会抛出一个错误。較好的方法是使用带有 setter 的双向绑定计算属性,如下:
<input v-model="message">
//....
computed: {
message: {
get () {
return this.$store.state.obj.message
},
set (value) {
this.$store.commit('updateMessage', value)
}
}
}
2020年6月14日 星期日
時間演算法
時間複雜度
程式運行的次數,迴圈越多複雜度越多,二分法查詢可以減少一般查詢的複雜度
O(nlog(n)) 、O(n2) O(2n) O(n))
https://medium.com/appworks-school/%E5%88%9D%E5%AD%B8%E8%80%85%E5%AD%B8%E6%BC%94%E7%AE%97%E6%B3%95-%E8%AB%87%E4%BB%80%E9%BA%BC%E6%98%AF%E6%BC%94%E7%AE%97%E6%B3%95%E5%92%8C%E6%99%82%E9%96%93%E8%A4%87%E9%9B%9C%E5%BA%A6-b1f6908e4b80
https://blog.techbridge.cc/2016/09/24/binary-search-introduction/
空間複雜度
變數有沒有變多,影響記憶體空間
常見的
O ( 1 )
O(n)
https://noob.tw/data-structure/
程式運行的次數,迴圈越多複雜度越多,二分法查詢可以減少一般查詢的複雜度
https://medium.com/appworks-school/%E5%88%9D%E5%AD%B8%E8%80%85%E5%AD%B8%E6%BC%94%E7%AE%97%E6%B3%95-%E8%AB%87%E4%BB%80%E9%BA%BC%E6%98%AF%E6%BC%94%E7%AE%97%E6%B3%95%E5%92%8C%E6%99%82%E9%96%93%E8%A4%87%E9%9B%9C%E5%BA%A6-b1f6908e4b80
https://blog.techbridge.cc/2016/09/24/binary-search-introduction/
空間複雜度
變數有沒有變多,影響記憶體空間
常見的
O(n)
https://noob.tw/data-structure/
2020年6月2日 星期二
deploy GitPage, add remote, change remote
https://cli.vuejs.org/guide/deployment.html#pwa (手動佈署)
手動佈署:
自動佈署:
手動佈署:
- 先在vue.config.js裡加上下列程式
- module.exports = {
- publicPath: process.env.NODE_ENV === 'production'
- ? '/my-project/'
- : '/'
- }
- 執行build之後,把要呈現的檔案放上gh-pages分支
自動佈署:
- 建立gh-pages分支,把打包好的檔案放入
- If you are using Vue CLI along with a backend framework that handles static assets as part of its deployment, all you need to do is make sure Vue CLI generates the built files in the correct location, and then follow the deployment instruction of your backend framework.
If you are developing your frontend app separately from your backend - i.e. your backend exposes an API for your frontend to talk to, then your frontend is essentially a purely static app. You can deploy the built content in the dist directory to any static file server, but make sure to set the correct publicPath.
需要做幾個步驟,見下面網址
https://cli.vuejs.org/guide/deployment.html#github-pages
$ git remote add origin https://github.com/user/repo.git
# Set a new remote
$ git remote set-url origin https://github.com/user/repo.git
# Set a change remote
訂閱:
文章 (Atom)