let mask = document.getElementsByClassName("weui-mask")[0];
let picker = document.getElementsByClassName("weui-picker")[0];
if (mask && picker) {
var btn = document
.getElementsByClassName("weui-picker")[0]
.getElementsByClassName("my-btn")[0];
var e = document.createEvent("MouseEvents");
e.initEvent("click", true, true);
btn.dispatchEvent(e);
}
发布评论
评论(1)
如果是用于spa单页应用:
当时我是用第二种方法做的,有点笨