代码改变世界

随笔档案-2017年10月

vue 全局配置键盘事件

2017-10-31 11:30 by 改吧, 3528 阅读, 收藏,
摘要: 在main.js配置 Vue.config.keyCodes.f1 = 112 然后可以在页面上@keyup.f12='demo' demo(){ console.log('demo')} 阅读全文

es6 module语法

2017-10-30 16:54 by 改吧, 470 阅读, 收藏,
摘要: import 第一种:import 写法:import { awaitAddGoodsList, goodsSkuList ,setSku} from '@/api/marketActivity' 引用:mounted(){ awaitAddGoodsList//直接使用 } 第二种:import 阅读全文

vue改变运行端口

2017-10-26 11:15 by 改吧, 295 阅读, 收藏,
摘要: config=>index.js=>set port 阅读全文

vue 数组和对象不能直接赋值情况和解决方法

2017-10-25 11:11 by 改吧, 9574 阅读, 收藏,
摘要: Vue 不能检测以下变动的数组: 当第一种情况需求时,可以使用this.$set(this.arr,index,newVal) Vue 不能检测对象属性的添加或删除: 可以使用this.$set(this.person,'age',12) 当需要添加多个对象时,Object.assign({},th 阅读全文

vue 子组件调用父组件的方法

2017-10-12 10:40 by 改吧, 803 阅读, 收藏,
摘要: 父组件定义 v-on:onRefresh=‘loadListData($1,$2)' loadListData是父组件的一个方法 onRefresh是一个定义变量需要传到子组件 子组件调用 this.$emit(‘onRefresh’,arg1,arg2); 父组件的方法需要用v-on来监听这个方法 阅读全文