1. Address:
2. Pit 1: vue2.0 I import main.js in the MintUI, but in the subassembly when I use Toast, suggesting that I undefined Toast, Toast only there Indicator Messagebox etc.
In min.js code:
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.config.productionTip = false
Vue.use(MintUI)
new Vue({
router,
render: h => h(App),
}).$mount('#app')
复制代码
Solution:
- 1. In the component introduced in use again
import { Toast } from 'mint-ui'
复制代码
-
- . $ Toast call View MintUi source index.js found by vm
Vue.$messagebox = Vue.prototype.$messagebox = MessageBox;
Vue.$toast = Vue.prototype.$toast = Toast;
Vue.$indicator = Vue.prototype.$indicator = Indicator;
复制代码
So when the call can be
handleSubmit () {
this.$toast(data.retMsg)
}
复制代码
Reproduced in: https: //juejin.im/post/5d099785f265da1b80204926