how to get a vue instance in the axios.js of the axios configuration of the vue project?
In thevue project, I can get the vue object by this in the .vue file, but this.XX cannot get the vue instance in the .js file. What should I do? I want to use the this.* method
.I want to use the this.$createElement of the vue instance in * .js, so I did this
this is what I wrote below, which solves my problem, but is it elegant?
import Vue from "vue"
import App from "./App.vue"
new Vue({
router,
store,
render: h => h(App),
created() {
Vue.prototype.$createElementNode = this.$createElement
}
}).$mount("-sharpapp")
inside the axios.js file:
import { MessageBox } from "element-ui";
import Vue from "vue"
const h = Vue.prototype.$createElementNode
MessageBox({
title: "",
// message: message,
message: h("div", null, [
h("el-input", {
props: {
value: 1234,
}
}),
h("el-input", {
props: {
value: 1234,
}
})
]),
showCancelButton: true,
confirmButtonText: "",
cancelButtonText: ""
})