1.問(wèn)題描述:
vue項(xiàng)目中使用ElementUI的表單form校驗(yàn)單的時(shí)候障簿,出現(xiàn)以下警告:
[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive.
雖然他不會(huì)直接影響項(xiàng)目出現(xiàn)報(bào)錯(cuò)或者無(wú)法正常運(yùn)行,但是這系列警告的存在就會(huì)為以后項(xiàng)目運(yùn)行出現(xiàn)未知問(wèn)題埋下隱患抒寂。
- 解決辦法
// 安裝插件
npm install -S default-passive-events
// 在main.js引入
import 'default-passive-events'
2.瀏覽器會(huì)顯示此類(lèi)的信息
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
-解決辦法:
要寫(xiě)在vue.js引入文件之后
<script>
Vue.config.productionTip = false
</script>
若還沒(méi)有則在vue.config.js中配置
configureWebpack: {
optimization: {
minimizer: [new TerserPlugin({ terserOptions: { compress: { drop_console: true }
} })]
},
}