Rychou / mpvue-vant

mpvue中无缝接入Vant Weapp组件库,所有组件均可使用。
404 stars 68 forks source link

请问你 Notify 组件能调用? #53

Open kid1412621 opened 5 years ago

kid1412621 commented 5 years ago

我看组件里面调用了小程序的 getCurrentPages 方法, 但是 mpvue 貌似有 bug ,所以我一直报错, 请问你那边怎么处理的?

Rychou commented 5 years ago

能调用的啊,贴一下代码看看

kid1412621 commented 5 years ago
<van-notify id="van-notify"/>
import Notify from '../../../dist/wx/miniprogram_npm/vant-weapp/notify/notify'
created(){
    Notify('加载失败')
}
kid1412621 commented 5 years ago

我是按照官方文档, npm 的方式装的 vant weapp 报错:

VM267:1 thirdScriptError 
 sdk uncaught third Error 
 Cannot read property 'selectComponent' of undefined 
 TypeError: Cannot read property 'selectComponent' of undefined
    at Notify (http://127.0.0.1:19939/appservice/pages/home/main.js:884:27)
    at Vue$3.created (http://127.0.0.1:19939/appservice/pages/home/main.js:249:115)
    at callHook (http://127.0.0.1:19939/appservice/common/vendor.js:2281:27)
    at Vue$3.Vue._init (http://127.0.0.1:19939/appservice/common/vendor.js:3588:11)
    at new Vue$3 (http://127.0.0.1:19939/appservice/common/vendor.js:3683:14)
    at Object._ (http://127.0.0.1:19939/appservice/pages/home/main.js:103:15)
    at __webpack_require__ (http://127.0.0.1:19939/appservice/common/manifest.js:75:31)
    at Object.webpackJsonpCallback [as webpackJsonpMpvue] (http://127.0.0.1:19939/appservice/common/manifest.js:42:26)
    at http://127.0.0.1:19939/appservice/pages/home/main.js:7:8
    at require (http://127.0.0.1:19939/appservice/__dev__/WAService.js:1:1077084)
Rychou commented 5 years ago

好 我之前没用过npm的形式引入 我后几天有时间复现一下