Skip to content

vue extend

the efficiency improvement of Vue itself is currently to provide some convenient abbreviations, mainly to optimize the options.

1、efficiency for html abbreviation

abbreviationvue html
vcomponent<component :is="componentId"></component>
vka<keep-alive></keep-alive>
vtransition<transition></transition>
vtg<transition-group></transition-group>
vrl<router-link></router-link>
vrlt<router-link to=''></router-link>
vrv<router-view></router-view>

2、efficiency for javascript abbreviation

abbreviationvue javascript
vgsilentVue.config.silent = true
vgehVue.config.errorHandler = function (err, vm, info) {}
vgwhVue.config.warnHandler = function (msg, vm, trace) {}
vgextendVue.extend({template: template})
vgsetVue.set(target, key, value)
vgdeleteVue.delete(target, key)
vdirectiveVue.directive({id, [definition]})
vgfilterVue.filter({id, [definition]})
vgcomponentVue.component({id, [definition]})
vgntVue.nextTick({})
vguseVue.use(plugin)
vgmixinVue.mixin({mixin})
vgcompileVue.compile(template)
vdatadata() { return
vmountedmounted () {}
vbmbeforeMount () {}
vcreatedcreated () {}
vbcbeforeCreate () {}
vupdatedupdated () {}
vbubeforeUpdate () {}
vactivatedactivated () {}
vdeactivateddeactivated () {}
vbdbeforeDestroy () {}
vdestroyeddestroyed () {}
vpropsprops: {}
vpdpropsData: {}
vcomputedcomputed: {}
vmethodsmethods: {}
vwatchwatch: {}
vwokey: { deep: true, immediate: true, handler: function (val, oldVal}) { } }
vdirectivesdirectives: {}
vfiltersfilters: {}
vcomponentscomponents: {}
vmixinsmixins:[]
vprovideprovide: {}
vinjectinject: []
vmodelmodel: {prop: '', event: ''}
vrenderrender(h) {}
vnewnew Vue({})
vntthis.$nextTick(() => {})
vdatathis.$data
vpropsthis.$props
velthis.$el
voptionsthis.$options
vparentthis.$parent
vrootthis.$root
vchildrenthis.$children
vslotsthis.$slots
vssthis.$scopedSlots.default({})
vrefsthis.$refs
visthis.$isServer
vattrsthis.$attrs
vlistenersthis.$listeners
vwatchthis.$watch(expOrFn, callback, [opitons])
vsetthis.$set(target, key, value)
vdeletethis.$delete
vonthis.$on(event, callback)
voncethis.$once(event, callback)
voffthis.$off(event, callback)
vemitthis.$emit(event, args)
vmountthis.$mount()
vfuthis.$forceUpdate()
vdestroythis.$destroy()

turn off the feature

this section is mainly for the efficiency of option programming, if you use the combination type does not need this part, you can remove the checkbox use-vue-snippets to turn off the feature.