Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当obj发生更改时,Web包开发服务器无法重新加载_Javascript_Vue.js - Fatal编程技术网

Javascript 当obj发生更改时,Web包开发服务器无法重新加载

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

如果我按以下方式修改,代码将导出一个Vue实例:

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')
    }
}