报错:
import { LoadingPlugin } from 'vux';
Vue.use(LoadingPlugin);
beforeCreate: function () {
this.$vux.loading.show({
text: 'Loading'
})
},
created: function () {
setTimeout(() => {
this.$vux.loading.hide()
}, 2000)
},
从一个页面进入另个页面时,显示loading ,2s后loading消失。
这是报错是怎么回事???
会Vue生命周期的老铁们,帮忙看看>_<
你
console.log(this.$vux)
应该是undefined。把这个显示loading的方法挂到根组件上。
在每个组件需要show的
beforeCreated
地方使用事件或者使用Vue.loading去调根组件的方法。