Vue中引用mint-ui时,Toast和Indicator的使用

在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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

潇I洒

创作不易,觉得有用就鼓励一下吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值