vue mixins混入js

版权声明:复制发表请附上原创博客地址 https://blog.csdn.net/weixin_41077029/article/details/84539617

a.js

export default {
   methods: {
    test1() {
      return true;
    }
  },
  test2(num){
    return num+5;
  }
}

b.vue

<template>
    <div>测试
        <span>{{test2("3")}}</span>
    </div>
</template>

import mixin from "@/a.js";
export default {
    mixins: [mixin],
    data(){

    },
    mounted() {
        this.test1();
   },
}

猜你喜欢

转载自blog.csdn.net/weixin_41077029/article/details/84539617