一、watch监听数据
1、监听普通的变量
data(){
return {
param1:"xxxx",
obj:{
a:"xx",
b:"yy",
c:"zz"
}
},
watch:{
param1:function(newValue,oldValue)
{
},//注意,下面对对象监听对象的的熟悉变化了,是监听不到的。
obj:function(newValue,oldValue)
{
},//要监听对象里面的数据,需要这样
"obj.a":function(newValue,oldValue)
{
},
"obj.b":function(newValue,oldValue)
{
}
}
}
1、vue.js里面直接用watch监听对象变量,如果对象变量的属性发生变化是无法监听到的。需要用"obj.param"这样的方式才能监听的到。
element-ui form 表单回车后自动刷新页面
@submit.native.prevent
webpack You are using the runtime-only build of Vue where the template compiler is no
在vue-router中使用template报错
在build/webpack.base.conf.js 中找到
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
vue: 'vue/dist/vue.js'
}
},