<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>
|