cuiqian2004
2025-10-17 49dfdd3bf265db28d38167f34e9aabfdd3e8e5db
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<template>
    <view class="oi-form-image-button">
        <image v-if="data.setting.imgUrl" :src="data.setting.imgUrl" :width="data.setting.imgWidth"
            :height="data.setting.imgHeight"> <button type="default" :style="{ color: data.setting.textColor }" :plain="
              ['info', 'success', 'warning', 'error', 'primary'].includes(data.setting.type)? data.setting.ghost: false"
                :class="data.setting.type + ' '+ data.setting.size" :disabled="data.disabled" @click="onClick">
                <!-- :size="data.setting.size == 'small' ? 'mini':data.setting.size == 'large' ? 'plus':'default'" -->
                <text v-if="data.setting.icon" class="img" :style="{color:data.setting.textColor}"></text>
                {{ data.setting.text ||""}}
            </button>
        </image>
        <button v-else type="default" :style="{ color: data.setting.textColor }" :plain="
              ['info', 'success', 'warning', 'error', 'primary'].includes(data.setting.type)? data.setting.ghost: false"
            :class="data.setting.type + ' '+ data.setting.size" :disabled="data.disabled" @click="onClick">
            <!-- :size="data.setting.size == 'small' ? 'mini':data.setting.size == 'large' ? 'plus':'default'" -->
            <text v-if="data.setting.icon" class="img" :style="{color:data.setting.textColor}"></text>
            {{ data.setting.text ||""}}</button>
    </view>
</template>
 
<script>
    export default {
        name: "OIFormImageButton",
        props: {
            data: {
                type: Object,
                required: true,
            },
        },
        data() {
            return {
                largeMode: getApp().globalData?.largeMode || false,
            }
        },
        methods: {
 
            onClick(e) {
                if (this.data.disabled)
                    return
                this.$emit("on-click", e)
            },
 
 
        },
    };
</script>
 
<style lang="less">
    .oi-form-image-button {
        // width: 100%;
 
        uni-button {
            padding: 14rpx;
            line-height: 1.4;
            font-size: 32rpx;
            display: inline-block;
        }
 
        .large {
            padding: 18rpx;
            line-height: 1.6;
            font-size: 36rpx;
        }
 
        .small {
            padding: 10rpx;
            line-height: 1.2;
            font-size: 28rpx;
        }
 
        .primary {
            color: #fff;
            background: #27A6E1;
            border: none;
        }
 
        .info {
            color: #fff;
            background-color: #2db7f5;
            border: none;
        }
 
        .success {
            color: #fff;
            background-color: #19be6b;
            border: none;
        }
 
        .error {
            color: #fff;
            background-color: #ed4014;
            border: none;
        }
 
        .warning {
            color: #fff;
            background-color: #f90;
            border: none;
        }
    }
</style>