组件发送事件
let ret : Map<string, any> = new Map();
ret.set("time", time);
ret.set("secValue", secValue);
let detail : Map<string, any> = new Map();
detail.set("detail", ret)
this.component.__$$emit("time", detail);
页面监听
@time="onTime"
onTime(e : any) {
console.log(e);
},
输出日志:
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
12:16:38.874 [object UniEvent] at pages/UTSDemo/TimeLineUTS.uvue:31
1 个回复
52yaoer (作者)
同样的代码,安卓输出正常
12:58:15.167 [UTSJSONObject] {secValue: 1729353613312, time: "00:00:13"} at pages/UTSDemo/TimeLineUTS.uvue:35
12:58:15.175 [UTSJSONObject] {secValue: 1729353613312, time: "00:00:13"} at pages/UTSDemo/TimeLineUTS.uvue:35
12:58:15.235 [UTSJSONObject] {secValue: 1729353613312, time: "00:00:13"} at pages/UTSDemo/TimeLineUTS.uvue:35
12:58:15.272 [UTSJSONObject] {secValue: 1729353613312, time: "00:00:13"} at pages/UTSDemo/TimeLineUTS.uvue:35