Tencent / kbone

一个致力于微信小程序和 Web 端同构的解决方案
Other
4.8k stars 457 forks source link

Cannot set property behavior of #<WxComponent> which has only a getter #51

Closed ikeq closed 4 years ago

ikeq commented 4 years ago

preact+typescript,使用小程序内置组件时报错。

用法:

<wx-switch />
<wx-component behavior="picker" mode="region">选择城市</wx-component>

报错:

VM1845:1 thirdScriptError
Cannot set property behavior of #<WxComponent> which has only a getter;at "pages/index/index" page lifeCycleMethod onLoad function
TypeError: Cannot set property behavior of #<WxComponent> which has only a getter
JuneAndGreen commented 4 years ago

看来 preact 比较与众不同,没有走 setAttribute,我给他补个 setter 吧

ikeq commented 4 years ago

看来没测过🌝

JuneAndGreen commented 4 years ago

😂preact 是其他热心同学帮忙一起搞的,他近期比较忙吧,我这边主要搞 vue。这个问题刚刚更新到 miniprogram-render@0.5.11 上了,https://github.com/wechat-miniprogram/kbone/commit/39649c6fb4065ce79f60452f2116ddfec96cb5bb