小程序中怎么引入wepy.js第三方toast组件

1.先安装组件
npm install wepy-com-toast --save
2.引入wepy和toast

    import wepy from 'wepy'
    import Toast from 'wepy-com-toast'

3.在组件里面去定义

       components = {
            toast: Toast,
            purchaselist:purchaseList,
            reportlist:reportList,
        }

4.去定义图标以及文字

      toast (title) {
            let promise = this.$invoke('toast', 'show', {
              title: title,
              img: ''
            })

            promise.then((d) => {
              // console.log('toast done')
            })
        }

转载于:https://www.cnblogs.com/antyhouse/p/9815335.html

你可能感兴趣的:(小程序中怎么引入wepy.js第三方toast组件)