首页 > 其他分享 >重写组件的方法

重写组件的方法

时间:2022-11-04 20:13:14浏览次数:191  
标签:混入 重写 mixins 组件 Input 方法

通过mixins混入重写组件

<script>
import { Input } from '某UI库' 
export default {
  name: 'Home',
  mixins: [Input], // 通过mixins混日,重写组件库的组件
  data() {
    return {
      // 同名数据会覆盖混入对象的数据,使用时,值是下面定义的值
      rewriteValue: ''
    }
  },
  methods: {
    // 同名的方法会覆盖混入对象的方法,将混入对象的方法粘过来,再加上自己需要的逻辑
    rewriteFunc() {
      // 。。。
    },
  }
}
</script>

标签:混入,重写,mixins,组件,Input,方法
From: https://www.cnblogs.com/jia-zq/p/16858966.html

相关文章