在mint-ui的官方文档中,介绍使用Toast和Indicator时,以Indicator为例,文档示例是通过Indicator.open();等方式来使用。可是如果我们这样使用,会发现会报Indicator is not defined的错误,根本用不了。
后来在通过查找的过程中,看到有人说Toast和Indicator是例外,首字母要用小写,正确的用法是:
全部引用
// 引用时
import Mint from 'mint-ui';
Vue.use(Mint);
// 使用时
this.$indicator.open('加载中...');
按需引用
另外,如果你是使用按需引用的方式,则应该是
// 引入时
import { Indicator } from 'mint-ui'
Vue.prototype.$Indicator = Indicator
// 使用时
this.$Indicator.open('加载中...');
参考链接:
https://segmentfault.com/q/1010000015766216
https://blog.youkuaiyun.com/weixin_38787614/article/details/86595925