Spublic.js
let Vue
const testFun = (e) =>{
console.log(e,"OK")
}
function install(_Vue) {
Vue = _Vue
Vue.mixin({
beforeCreate(){
if(this.$options.Song){
Vue.prototype.$testFun=testFun
}
}
})
}
export default {install}
复制代码
main.js
import Vue from 'vue'
import Song from './utils/sPublic';
Vue.use(Song)
new Vue({
Song,
render: h => h(App),
}).$mount('#app')
复制代码
.vue
beforeCreate(){
this.$testFun('调用')
}
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END





















![[桜井宁宁]COS和泉纱雾超可爱写真福利集-一一网](https://www.proyy.com/skycj/data/images/2020-12-13/4d3cf227a85d7e79f5d6b4efb6bde3e8.jpg)

![[桜井宁宁] 爆乳奶牛少女cos写真-一一网](https://www.proyy.com/skycj/data/images/2020-12-13/d40483e126fcf567894e89c65eaca655.jpg)