Vue 一些零零散散~

1. F5刷新不会触发vue的destroyed事件.

2. computed 的 vuex 数据 ------>   beforeCreated: undefined   /    created: 有数据.

3. vue打包后会产生map文件. map文件作用是打包后还能精准定位代码错误位置 . 取消方法 ------> /config/index.js  /   productionSourceMap:false .

4. vue中input框监听回车键  ------->    @keyup.enter="fn()" .

5. vue中input自动聚焦

1 directives: { 
2     focus: { 
3       inserted: function (el) { 
4          el.focus() 
5       } 
6     } 
7 }    
1 <input v-focus />

 6. vuex 的 v-model 双向数据绑定

computed: {
    getVal: {
        get() {
             return this.$store.state.val
        },
         set(newVal) {
             this.$store.commit('handleVal', newVal)
         }
    }
}
<input v-model="getVal" />

 7. computed 属性不能修改, 如果需要在computed属性的基础上修改数据, 在created中赋值给data, 然后维护data;

8. vue-cli 在ie上打不开的问题, npm i babel-polyfill -D , 在main.js中引入 Import "babel-polyfill" , 在build/webpack.base.conf.js中, entry : ["babel-polyfill",'./src/main.js']   搞定!!

9. nuxt.js 苹果跳路由用params传参数传不过来, 用query传

posted @ 2019-06-18 10:45  唉呀妈呀梅西  阅读(160)  评论(0)    收藏  举报