提交 f9d00337 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

调整 open-type 示例。

上级 8fe93144
......@@ -205,14 +205,14 @@
"navigationBarTitleText": "textarea | 多行输入框"
}
},
// #ifdef APP
{
"path": "pages/component/open-type/open-type",
"group": "0,3,12",
"style": {
"navigationBarTitleText": "button | open-type"
}
},
// // #ifdef APP
// {
// "path": "pages/component/open-type/open-type",
// "group": "0,3,12",
// "style": {
// "navigationBarTitleText": "button | open-type"
// }
// },
//#endif
{
"path": "pages/component/slider/slider",
......
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<button id="opentype" style="margin: 12px;" type="primary"
open-type="agreePrivacyAuthorization">agreePrivacyAuthorization</button>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<button style="margin: 12px;" type="warn" @click="reset">resetPrivacyAuthorization</button>
<script>
export default {
data() {
return {
isAgreeRes: false,
log: "",
number: 0
}
},
unmounted() {
console.log('unmounted', this.number)
uni.offPrivacyAuthorizationChange(this.number)
},
onLoad() {
this.number = uni.onPrivacyAuthorizationChange((callback) => {
<text style="margin: 12px; color:red; font-size: 18px;">当前隐私政策状态:{{ state }}</text>
<text style="margin: 12px; color:darkred; font-size: 16px;">true = 已同意隐私协议; false = 未同意隐私协议</text>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
isAgreeRes: false,
log: "",
number: 0,
state: false
}
},
unmounted() {
console.log('unmounted', this.number)
uni.offPrivacyAuthorizationChange(this.number)
},
onLoad() {
uni.getPrivacySetting({
success: (res) => {
this.state = !res.needAuthorization
}
})
this.number = uni.onPrivacyAuthorizationChange((callback) => {
this.isAgreeRes = !callback.needAuthorization
uni.showToast({
title: 'isPrivacyAgree:' + this.isAgreeRes
})
})
},
methods: {
}
}
</script>
<style>
this.state = this.isAgreeRes
uni.showToast({
title: 'isPrivacyAgree:' + this.isAgreeRes
})
})
},
methods: {
reset() {
uni.resetPrivacyAuthorization()
}
}
}
</script>
<style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册