assets/js:
import Vue from "vue";
import Router from "vue-router";
export default({
//
back:function(){
this.$router.go(-1);
},
})
main.js:
//
import global from "./assets/js/global.js"
Vue.prototype.common = global
xx.vue:
<van-icon slot="right" @click="goto()"></van-icon>
methods:{
//
goto:function(){
this.common.back();
}
}
am I mistaken that the global approach doesn"t work?