Skip to content

微信转支付宝小程序报找不到子组件属性 #250

@coalo

Description

@coalo

Describe the bug
微信转支付宝小程序报找不到子组件属性

To Reproduce
Steps to reproduce the behavior:
1.微信使用组件id引用子组件 :
this.selectComponent('#auth').openModal()

2.mor转化成支付宝后报错:
[APPX][Page] pages/index/index/0 CallMethod error Cannot read properties of undefined (reading 'openModal')/TypeError: Cannot read properties of undefined (reading 'openModal')
at Object.onLoad (http://127.0.0.1:57861/index.worker.js?hash=77fb2ee4&from_service_worker=true&url=file%3A%2F%2F%2Fhttp%3A%2F%2F127.0.0.1%3A57861%2Findex.html&page=pages%2Findex%2Findex&appId=2021001183613689&ap_framework_sceneId=0000&enablePolyfillWorker=true&ap_framework_sceneId=0000:19131:46)
at Object. (http://127.0.0.1:57861/index.worker.js?hash=77fb2ee4&from_service_worker=true&url=file%3A%2F%2F%2Fhttp%3A%2F%2F127.0.0.1%3A57861%2Findex.html&page=pages%2Findex%2Findex&appId=2021001183613689&ap_framework_sceneId=0000&enablePolyfillWorker=true&ap_framework_sceneId=0000:38570:44)
at Object. (http://127.0.0.1:57861/index.worker.js?hash=77fb2ee4&from_service_worker=true&url=file%3A%2F%2F%2Fhttp%3A%2F%2F127.0.0.1%3A57861%2Findex.html&page=pages%2Findex%2Findex&appId=2021001183613689&ap_framework_sceneId=0000&enablePolyfillWorker=true&ap_framework_sceneId=0000:40678:33)
at Object.onLoad (http://127.0.0.1:57861/index.worker.js?hash=77fb2ee4&from_service_worker=true&url=file%3A%2F%2F%2Fhttp%3A%2F%2F127.0.0.1%3A57861%2Findex.html&page=pages%2Findex%2Findex&appId=2021001183613689&ap_framework_sceneId=0000&enablePolyfillWorker=true&ap_framework_sceneId=0000:40678:33)
at e.invokePublicMethod (https://appx/af-appx.worker.min.js:6:486960)
at s.invokePageEvent (https://appx/af-appx.worker.min.js:6:729721)
at e.invokePageEvent (https://appx/af-appx.worker.min.js:6:986672)
at F (https://appx/af-appx.worker.min.js:6:6175)
at r. [as invokePageEvent] (https://appx/af-appx.worker.min.js:6:102749)
at e.performLifeHook (https://appx/af-appx.worker.min.js:6:483087) 1765523218008

mor构建后代码:
1.我看mor对子组件axml是进行转化了,并声明了:

"com-auth": "../../components/comAuth/comAuth",
2.但是对组件的js引用还是微信小程序那套:
this.selectComponent('#auth').openModal(); 并没有转化成支付宝的类似: authRef (ref) {
this.authContent = ref
},这种方式

请问我需要自己再封装一个关于子组件引用的不同端适配层吗?还是我需要在mor里添加什么设置来支持微信小程序的selectComponent的写法对支付宝的转化

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions