linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
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
export default {
    data() {
        return {
            radioGroupValue: '', //当前 radioGroup 选中的值
            radioValue: '', // 当前 radio 的值
            num: 0, //用于区分是否是重复选中
        }
    },
    methods: {
        isPrivacyCheck() {
            if (this.radioValue != "check") {
                uni.showToast({
                    title: "请先同意隐私政策",
                    icon: "none",
                    complete: () => {
                        return false
                    }
                })
            } else {
                return true
            }
        },
        groupChange(n) {
            if (n == this.radioValue && this.num == 0) {
                // 第一次相等即执行以下代码
                this.num++
            } else {
                // 第一次后相等即执行以下代码
                // 置空 radioGroupValue 即取消选中的值
                this.radioGroupValue = ''
                this.radioValue = ''
                // 初始化 num
                this.num = 0
            }
        },
        // 当切换其他选项的时候此方法才会执行
        radioChange(n) {
            this.radioValue = n
            // 切换选项后需要初始化 num
            this.num = 0
        },
    }
}