Vue interface encapsulation problem

Note: get and post are encapsulated in axios.js. Common.js sibling in the directory

clipboard.png

//common.js


//InstitutionSetup.vue


clipboard.png

Jan.14,2022

Vue.prototype.$axios = axios


the introduction of axios is not mounted on Vue. You can add Vue.prototype.axios = axios before export default and the following code can be used


this question
you should be Vue.prototype.common = common

this.login () this in this login is vue instance
this.common.login () this login this is common , not vue instance

this.common.login.call (this)

can be understood in this way

import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'
export default{
    login:function(){
        axios.get("", {})
        .then(res => {
            let { msg, code, data } = res.data;
            if (code !== 1) {
                this.$message({
                    message: msg,
                    type: "error"
                });
            } else {
                console.log(res);
            }
        })
        .catch(function(error) {
            console.log(error);
        });
    }
}
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-1ea7238-1e35.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-1ea7238-1e35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?