每次在调用vuxtoast插件的时候  大都是在vue项目的实例中。

main.js

import Vue from 'vue';
import { ToastPlugin } from 'vux'
Vue.use(ToastPlugin)

Vue页面中

 

export default {    
data () {
      return {}
},
methods: {
      goToast() {
        this.$vux.toast.show({
        type: 'text',
        position: 'middle',
        text: "消息提示!"
      })
    }
  }
}

 

但当在api.js中调用toast的写法就不是如此了。代码如下:

 

import Vue from 'vue';
import { ToastPlugin } from 'vux'

Vue.use(ToastPlugin)

let vm = new Vue()

vm.$vux.toast.show({
    type: 'text',
    position: 'middle',
    text: "消息提示!"
})

 

相关文章:

  • 2021-08-30
  • 2021-08-30
  • 2021-12-18
  • 2021-08-30
  • 2022-12-23
  • 2021-11-19
  • 2020-04-22
猜你喜欢
  • 2022-12-23
  • 2018-09-15
  • 2021-08-30
  • 2022-12-23
  • 2021-09-03
  • 2021-11-13
  • 2021-08-30
相关资源
相似解决方案