Taro@4.0.7 转鸿蒙 `cssStyleDeclaration` 方法没有考虑到原型链上的属性取值
Opened this issue · 1 comments
jxxbd91 commented
相关平台
鸿蒙
使用框架: Vue 3
复现步骤
- 实际使用的taro 版本 4.0.7,但是上面无法选中
- 源代码链接位置 https://github.com/NervJS/taro/blob/feat/4.0.8/packages/taro-platform-harmony/src/runtime-ets/dom/cssStyleDeclaration.ts#L76-L80
public getPropertyValue (prop: string): string | number {
prop = prop.includes('-') ? toCamelCase(prop) : prop
const node = this.el
const value = node._st[prop]
// 这里可能是从 this 的原型链上获取值,如果仅仅判断 this.el 是否有值在部分场景会报错。
// 看看是否改成 return value === undefined ? this[prop] ?? '' : value
return value === undefined ? '' : value
}
例如:在 vue3 runtime-dom 中会调用 style.setProperty 方法,由于经过了 Taro 的代理 https://github.com/NervJS/taro/blob/feat/4.0.8/packages/taro-platform-harmony/src/runtime-ets/dom/cssStyleDeclaration.ts#L106, 得到的返回结果是 空字符串,这个时候就会报错
期望结果
可以正常调用不报错
实际结果
style.setProperty is not callable
环境信息
Taro CLI 4.0.7 environment info:
System:
OS: macOS 13.3.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
npmPackages:
@tarojs/cli: 4.0.7 => 4.0.7
@tarojs/components: 4.0.7 => 4.0.7
@tarojs/helper: 4.0.7 => 4.0.7
@tarojs/plugin-framework-vue3: 4.0.7 => 4.0.7
@tarojs/plugin-platform-alipay: 4.0.7 => 4.0.7
@tarojs/plugin-platform-h5: 4.0.7 => 4.0.7
@tarojs/plugin-platform-harmony-ets: ^4.0.7 => 4.0.7
@tarojs/plugin-platform-jd: 4.0.7 => 4.0.7
@tarojs/plugin-platform-qq: 4.0.7 => 4.0.7
@tarojs/plugin-platform-swan: 4.0.7 => 4.0.7
@tarojs/plugin-platform-tt: 4.0.7 => 4.0.7
@tarojs/plugin-platform-weapp: 4.0.7 => 4.0.7
@tarojs/runtime: 4.0.7 => 4.0.7
@tarojs/shared: 4.0.7 => 4.0.7
@tarojs/taro: 4.0.7 => 4.0.7
@tarojs/vite-runner: 4.0.7 => 4.0.8-beta.0
babel-preset-taro: 4.0.7 => 4.0.7
eslint-config-taro: 4.0.7 => 4.0.7