uniapp針對openinstall無法統計到註冊量的問題解決方案及demo
這個是與openinstall官方成員一起解決掉的 bug問題,因爲原生SDK插件支持帶來的相關問題。
由於註冊統計代碼 放入非app.vue 全局文件而無法引入插件配置導致的問題。
這是最後解決方案。
template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
<button v-on:click="testRegister">測試註冊</button>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
testRegister:function(even){
console.log('button click')
const openinstall = uni.requireNativePlugin('openinstall-plugin');
openinstall.reportRegister();
}
},
};
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
代碼片段