App.vue:
注册全局组件:
import toastr from './common-componetnt/toastr/toastr.vue'
Vue.component('toastr', toastr);
组件里边使用:
<template>
<toastr ref="toastr"></toastr>
</template>
script:
this.$refs.toastr.success("成功")
App.vue:
注册全局组件:
import toastr from './common-componetnt/toastr/toastr.vue'
Vue.component('toastr', toastr);
组件里边使用:
<template>
<toastr ref="toastr"></toastr>
</template>
script:
this.$refs.toastr.success("成功")
转载于:https://www.cnblogs.com/lyls/p/7500257.html