cuiqian2004
2025-03-20 c094d4a32180130de0c26c75a5abc414128a5ec1
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
<template>
    <view class="oi-form-switch">
        <!-- Switch开关 -->
        <switch v-if="model" :class="data.disabled?'input-disabled':''" :disabled="data.disabled"
            v-model="model[data.fieldId]" @change="onChange" />
        <switch v-else :class="data.disabled?'input-disabled':''" :disabled="data.disabled" v-model="data.value"
            @change="onChange" />
    </view>
</template>
 
<script>
    export default {
        name: "OIFormSwitch",
        props: {
            data: {
                type: Object,
                required: true,
            },
            model: Object,
        },
        methods: {
            onChange(e) {
                this.$emit("on-change", e)
            },
 
 
        }
    };
</script>
 
<style lang="less" scoped>
    .oi-form-switch {
        vertical-align: middle;
        margin-left: 10rpx
    }
</style>