V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
oyp
V2EX  ›  程序员

Vue.config.productionTip = false 为什么失效了

  •  
  •   oyp · Aug 18, 2022 · 1077 views
    This topic created in 1349 days ago, the information mentioned may be changed or developed.
    <body>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
        <script>
            Vue.config.productionTip = false;
        </script>
    </body>
    

    Vue 原代码

    if (config.productionTip !== false &&
        typeof console !== 'undefined'
    ) {
        console[console.info ? 'info' : 'log'](
            "You are running Vue in development mode.\n" +
            "Make sure to turn on production mode when deploying for production.\n" +
            "See more tips at https://vuejs.org/guide/deployment.html"
        );
    }
    

    然后控制台依然有生产提示,搞不懂,Vue2 从 2.2.0 往上试,都是。

    调试下发现,Vue 先判断 Vue.config.productionTip 是不是 true ,然后提示这个,默认是 true 的,而我上面的代码的确把 Vue.config.productionTip 改成了 false ,但我看是先判断了值为 true ,然后我的代码才生效,改成 false ,这个顺序是不是不太对。诶,大佬们看下为什么

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3649 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 04:54 · PVG 12:54 · LAX 21:54 · JFK 00:54
    ♥ Do have faith in what you're doing.