MPComponent / mpvue-picker

基于 mpvue 框架的小程序选择控件,支持单列,多列,联动。
MIT License
172 stars 77 forks source link

从dcloud插件市场,下载运行,弹出show报错 #24

Closed RobinGitHub closed 5 years ago

RobinGitHub commented 5 years ago

this.$refs.mpvuePicker.show is not a function. (In 'this.$refs.mpvuePicker.show()', 'this.$refs.mpvuePicker.show' is undefined); 请问报这个错误是什么问题呢?

KuangPF commented 5 years ago

能否提供一下详细的使用代码,包括编辑器信息这些。

RobinGitHub commented 5 years ago

使用的工具是Hbuilder X 最新版,我从dcloud插件市场下载的文件放入components目录中, 然后按照示例 image粘贴复制,执行后就提示以下错误

this.$refs.mpvuePicker.show is not a function;at pages/login/login page handleProxy function
TypeError: this.$refs.mpvuePicker.show is not a function
at Vue$3.bindLogin (uni-app:///pages/login/login.vue?vue&type=script&lang=js&?01f1:143:30)
at Array.boundFn (D:/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/mpvue/index.js:249:63)
(D:/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/mpvue/index.js:5550:40)
at e.handleProxy (D:/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/mpvue-page-factory/index.js:76:24)

KuangPF commented 5 years ago

我从插件市场下载,做了一个简单的测试,引入了 src/pages/demo/index.vue中的示例代码,改了下 mpvue-picker 的引入方式,即以 dcloud 插件的方式引入,其他地方没变,如下:

import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';

并没有复现问题,测试了微信小程序和浏览器都能正常工作。

issues-24-01 issues-24-02

你可以尝试在 HBuilderX 运行一下本仓库里面的 demo,改一下插件的引入就可以了,看能不能正常运行。

除此之外,你还可以直接通过 npm 的安装方式引入 mpvue-picker,并在 HBuilderX 中使用,使用方法和 mpvue 的语法一样,可参考 readme。

RobinGitHub commented 5 years ago

好的,谢谢,我再试一下

shenzhuan commented 4 years ago

h5没有问题,小程序报错 Cannot read property 'show' of undefined; [Component] Event Handler Error @ pagesU/address/addressManage#handleEvent

shenzhuan commented 4 years ago

@RobinGitHub