index.vue
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<template>
<view>
<view class="Protocol" @click="select">
<u-checkbox-group v-model="checked">
<u-checkbox shape="circle" label=" " :name="1"></u-checkbox>
</u-checkbox-group>
<view>
我已阅读并同意<text style="color: #2d81ff;" @tap.stop ="openYonghu">《用户协议》</text>和<text style="color: #2d81ff;" @tap.stop="openYinSi">《隐私政策》</text>
</view>
</view>
<UserAgreementPop ref="userAgreementPopRef" />
<PrivacyPolicyPop ref="privacyPolicyPopRef" />
</view>
</template>
<script>
import UserAgreementPop from "@/components/UserAgreementPop/index.vue"
import PrivacyPolicyPop from "@/components/PrivacyPolicyPop/index.vue"
export default {
name: 'Protocol',
components: {
UserAgreementPop,
PrivacyPolicyPop
},
computed: {
checked: {
get() {
if(!this.value) {
return []
} else {
return [1]
}
},
set(val) {
console.log(val)
if(val.length) {
this.$emit('input', true)
} else {
this.$emit('input', false)
}
}
}
},
model: {
event: 'input',
prop: 'value'
},
props: {
value: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
methods: {
openYinSi() {
this.$refs.privacyPolicyPopRef.open()
},
openYonghu() {
this.$refs.userAgreementPopRef.open()
},
select() {
if(this.checked.length) {
this.checked = []
} else {
this.checked = [1]
}
}
}
}
</script>
<style lang="scss" scoped>
.Protocol{
display: flex;
align-items: center;
font-size: 26rpx;
}
</style>