Vue mixins extend
const mixins = {
created () {
console.log('mixins created')
}
}
const mixins2 = {
created () {
console.log('mixins2 created')
}
}
const extend = {
created () {
console.log('extends created')
}
}
export default {
mixins: [mixins, mixins2],
extends: extend,
created () {
console.log('组件 created')
}
}
控制台输出:
extends只能继承一个
mixins可以多个
作者:孟繁贵 Email:meng010387@126.com 期待共同进步!