weex + weex UI : TypeError: _vm._px2rem is not a function

问题解决了: 使用 weexpack create 项目名 创建项目即可,不要使用官方文档中的 weex create 项目名!!!


使用 weex 创建项目,引入 weex-ui,复制 weex-ui 的 demo 代码,运行后浏览器控制台报错:

[Vue warn]: Property or method "_px2rem" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <WxcButton> at /Users/xuyuning/Sites/myApp/node_modules/weex-ui/packages/wxc-button/index.vue
       <HelloWorld> at /Users/xuyuning/Sites/myApp/src/components/HelloWorld.vue
         <Root>

看上去是 _px2rem 这个包调用失败,而这个 WxcButton 是在 node_modules/ 中的,没有修改权限。

有遇到类似问题的同学吗??求解!!!

阅读 4.6k
1 个回答

我调用正常, 你检查一下weexpack版本

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题