Home > Article > Web Front-end > Share an example code of vue global configuration
Today we learn about vue global configuration. I hope it will help us understand the global configuration of vue and develop quickly.
Vue.config is the global configuration object of vue. Contains all global properties of Vue:
The code is as follows:
silent:boolean(默认值:false)----取消Vue的所有的日志与警告 ;用法:Vue.config.silent = true optionMergeStrategies:{[key:string]:Function}(默认是空对象{}) vue.config.optionMergeStrategies._my_option = function (parent, child, vm) { return child + 1 } 自定义合并策略的选项:接受第一个参数是父实例,第二个参数实例为子实例,第三个参数是Vue实例上下文 const Profile = Vue.extend({ _my_option: 1 }) devtools:boolean(默认是true,生成版为false) 用法:Vue.config.devtools = true 配置是否允许vue-devtools检查代码。开发版本默认为:true ,生产为false errorHandler:Funtion (默认值是默认抛出错误)用法: Vue.config.errorHandler = function (err, vm) { // handle error }在指定组件的渲染和观察期间未捕获错误的处理函数。这个处理函数被调用时,可以获取错误信息和vue实例 ignoredELements:array<string>(默认是【】)用法: Vue.config.ignoredElements = [ 'my-custom-web-component', 'another-web-component' ]拼错组件名称,从而抛出一个关于Unknown custom element keyCodes:{[ key:string]:number | Array <number>} (默认是{})用法:Vue.config.keyCodes = { v:86, F1:112,mediaPlayPause:179,up:[38,87]} 这个多半伴随v-on 自定义键位别名。
[Related recommendations]
1. Free h5 online video tutorial
3. php.cn original html5 video tutorial
The above is the detailed content of Share an example code of vue global configuration. For more information, please follow other related articles on the PHP Chinese website!