Vue wrote a global method, but it didn't work.

I created a new global.js file under

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?


solved

//
back:function(){
    window.history.go(-1);
},

this is determined by your back in this is common


back:function(){
    this.$router.go(-1);
}

this Vue

I got it wrong.

this should be the problem of this

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35e4c-2b333.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35e4c-2b333.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?