Javascript 当obj发生更改时,Web包开发服务器无法重新加载
如果我按以下方式修改,代码将导出一个Vue实例:Javascript 当obj发生更改时,Web包开发服务器无法重新加载,javascript,vue.js,Javascript,Vue.js,如果我按以下方式修改,代码将导出一个Vue实例: export default { data() { return { userName: 'naraku', itemTotal: [1,2,3,4,5,6,7,8,9], nickName: 'ljs' } }, methods: { notify: function(e){ v
export default {
data() {
return {
userName: 'naraku',
itemTotal: [1,2,3,4,5,6,7,8,9],
nickName: 'ljs'
}
},
methods: {
notify: function(e){
var i = 0;
}
},
components: {
'hello': require('../components/hello.vue')
}
}
他成功了。但我这样修改:
console.log('change'); //
export default {
data() {
return {
userName: 'naraku',
itemTotal: [1,2,3,4,5,6,7,8,9],
nickName: 'ljs'
}
},
methods: {
notify: function(e){
var i = 0;
}
},
components: {
'hello': require('../components/hello.vue')
}
}
它不起作用。视图上没有任何更改。为什么?你是说热装?是的!您的语句是否正确可能您已经在热重新加载时调用了
data()
?
export default {
data() {
return {
userName: 'hello', // change the userName
itemTotal: [1,2,3,4,5,6,7,8,9],
nickName: 'ljs'
}
},
methods: {
notify: function(e){
var i = 0;
}
},
components: {
'hello': require('../components/hello.vue')
}
}