Closed RobinGitHub closed 5 years ago
能否提供一下详细的使用代码,包括编辑器信息这些。
使用的工具是Hbuilder X 最新版,我从dcloud插件市场下载的文件放入components目录中, 然后按照示例 粘贴复制,执行后就提示以下错误
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)
我从插件市场下载,做了一个简单的测试,引入了 src/pages/demo/index.vue中的示例代码,改了下 mpvue-picker
的引入方式,即以 dcloud
插件的方式引入,其他地方没变,如下:
import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';
并没有复现问题,测试了微信小程序和浏览器都能正常工作。
你可以尝试在 HBuilderX 运行一下本仓库里面的 demo,改一下插件的引入就可以了,看能不能正常运行。
除此之外,你还可以直接通过 npm 的安装方式引入 mpvue-picker
,并在 HBuilderX 中使用,使用方法和 mpvue
的语法一样,可参考 readme。
好的,谢谢,我再试一下
h5没有问题,小程序报错 Cannot read property 'show' of undefined; [Component] Event Handler Error @ pagesU/address/addressManage#handleEvent
@RobinGitHub
this.$refs.mpvuePicker.show is not a function. (In 'this.$refs.mpvuePicker.show()', 'this.$refs.mpvuePicker.show' is undefined);
请问报这个错误是什么问题呢?