打赏

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可以多个

posted @ 2018-06-18 18:38  孟繁贵  阅读(334)  评论(0编辑  收藏  举报
TOP