简述功能:友盟U-link可以从H5页面唤起手机上的app,若手机上没有安装app会引导下载,可以通过H5给app传递自定义参数,还有在QQ或微信浏览器环境下会引导到外部浏览器打开(自我理解,大佬勿打脸)
1.首先引入友盟Ulink的CDN包
mounted() {
const script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://g.alicdn.com/jssdk/u-link/index.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
}
2.包引入后会挂载的window原型上,然后进行配置就行了
mounted() {
const script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://g.alicdn.com/jssdk/u-link/index.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
//等待挂载完成
script.onload = function () {
window.ULink([
id: "", //后台生成的裂变活动LinkID
data: {}, //data就是前端传给app的一些自定义参数,自定义参数可能会从url上获取而来,这个随意
selector: "#btn", //页面下载按钮的id,点击会触发跳转(页面按钮好像只能用button标签,不能用div)
//还有很多配置具体看友盟官网文档..........
}])
}
友盟JS具体开发文档:https://developer.umeng.com/docs/191212/detail/193297