【备忘录】不使用mixin,公用方法运行于vue-scope下

common.js中个方法:

export const foo = function () {
};

foo运行于demo.vue中

<template>..</template>

<script>
  import { foo } from './common'

  export default {
    mounted() { 
      this.foo = foo.bind(this);
    }
  }
</script>

 

posted @ 2018-04-17 15:34  xiaoroad  阅读(115)  评论(0编辑  收藏  举报