细节请查看:https://ask.dcloud.net.cn/question/91225
按照官方的方档编写自定义component组件,uniapp页面没有效果
在页面上调用:
methods:{
play:function(){
var b = weex.isRegisteredComponent("mycomponent");
uni.showModal({
content:'开始播放:'+b,
showCancel:false
});
const self = this;
self.$refs.mycompt.play({'text':'123'},result=>{
uni.showModal({
content:'调用成功',
showCancel:false
});
console.log('success');
self.rv = result
});
}
}
弹了提示b=true,但是页面没有显示textView效果,异步play方法,也提示错误:
thirdScriptError
16:35:45.920 undefined is not an object (evaluating 'self.$refs.mycompt.play'); [Component] Event Handler Error @ components/tipsoft-video/video#handleEvent
16:35:45.940 play
16:35:45.960 play@[native code]
16:35:46.001 forEach@[native code]
16:35:46.041 forEach@[native code]
16:35:46.061 handleEvent
16:35:46.081 safeCallback@weex createInstanceContext:4:425719
16:35:46.102 weex createInstanceContext:4:566466
16:35:46.122 __hookEvent@weex createInstanceContext:4:773
16:35:46.142 weex createInstanceContext:4:566435
16:35:46.162 weex createInstanceContext:4:569696
16:35:46.182 weex createInstanceContext:4:568970
16:35:46.202 n@weex createInstanceContext:4:171534
16:35:46.222 subscribeHandler@weex createInstanceContext:4:2190
16:35:46.249 weex createInstanceContext:3:88755
16:35:46.269 weex createInstanceContext:3:88776
16:35:46.289 N@weex createInstanceContext:3:8336
16:35:46.309 Se@weex createInstanceContext:3:23015
16:35:46.335 consume@(weex framework):1:1263
16:35:46.355 map@[native code]
[内容]
重现步骤
[步骤]
1、编写component类,继承WXComponent
2、编写WXComponent_AppProxy类,实现AppHookProxy接口,进行组件注册;
3、配置dcloud_uniplugins.json,"hooksClass" : "com.tipsoft.video.VideoPlayWXComponent_AppProxy"
4、进行打包aar
5、新建离线插件、在manifest.json配置本地插件
6、在nvue页面中引入compoent组件。
[结果]
引入的compoent不生效,页面不显示控件
[期望]
页面上显示原生TextView控件
IDE运行环境说明
[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]
HbuilderX 2.6.5
[IDE版本号]
[windows版本号]
Windows 7
[mac版本号]
uni-app运行环境说明
[运行端是h5或app或某个小程序?]
[运行端版本号]
[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]
[编译模式说明:自定义组件模式?纯nvue模式?v3模式?]
默认的模式
App运行环境说明
[Android版本号]
android 4.4.4
[iOS版本号]
[手机型号]
[模拟器型号]
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
https://ask.dcloud.net.cn/question/91225
[App安装包或H5地址]
[可重现代码片段]
联系方式
[QQ] 54201282
0 个回复