App.vue
<script>
export default {
onLaunch: function() {
console.log('App Launch');
// 第一次安装,获取的设备信息clientid为null
// 用于解决plus.push.getClientInfo同步获取可能返回数据为空的问题
// 要延迟一点时间获取,具体延迟多长不确定。使用以下代码解决
var t1 = setInterval(() => {
var info = plus.push.getClientInfo();
var clientid = info.clientid; // 注意:clientid为空时,返回的是字符串"null"
if(clientid && clientid != "null") {
console.log(clientid) // 客户端标识
clearInterval(t1);
}
},50);
}
};
</script>
0 个评论
要回复文章请先登录或注册