1、只有在data中声明的变量改变时,才会自动刷新页面
2、子组件this.emit在真机app中的问题
以下是真机app可以正常运行的写法(参数$event是点击信息)√
<view class="cancel" @click="cancel($event)">取消</view>
......
methods:{
cancel(e){
this.$emit("cancel")
}
}
以下是真机app中会报错的写法(this打印出来是null)
//这里的cancel不加括号,methods中this会是null
<view class="cancel" @click="cancel">取消</view>
......
methods:{
cancel(){
this.$emit("cancel")
}
}