首页 > 解决方案 > 在哪里插入Vue.productionTip = false 以摆脱vue开发模式警告

问题描述

当谈到 js 时,我是一个完全的新手,我所要做的就是插入该行以关闭消息,但无论我把它放在哪里,消息都会保留。我的代码是

var getCalculatorApp = (function () {
    var initialize = function () {      
        new Vue({ 
            el: "#content",
            data: {
                region: "England"
            } //then others stuff and methods
        }); 
    }
    return {
        initialize: initialize
    };
})

标签: vue.js

解决方案


您可以将其添加到您的顶部getCalculatorApp

var getCalculatorApp = (function () {
    Vue.productionTip = false
    var initialize = function () {      
        new Vue({ 
            el: "#content",
            data: {
                region: "England"
            } //then others stuff and methods
        }); 
    }
    return {
        initialize: initialize
    };
})

但是要关闭警告,您很可能需要进行生产构建,并且该标志不会改变它。


推荐阅读