onShareAppMessage函数能不能获取​视图层上data-的值
发布于 6 年前 作者 laiyong 3831 次浏览 来自 问答

<button open-type=“share” data-url="{{item.url}}">转发</button>

自定义函数,可以通过 event.currentTarget.dataset.url获取到data-url

onShareAppMessage函数res参数怎么获取button的data-url的

onShareAppMessage: function (res) {

if (res.from === ‘button’) {

// 来自页面内转发按钮

console.log(res.target)

}

2 回复

res 没有 data-url的值

你打印一下res看一下

回到顶部