You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
apply-assistant-v3/components/button.vue

309 lines
5.5 KiB
Vue

6 months ago
<template>
<view class="g-components-button">
6 months ago
<button class="bocai-btn" :class="['bocai_btn_size_' + size, 'bocai_btn_mode_' + mode, 'bocai_btn_type_' + type, 'g_w_' + width, 'g_h_' + height, customBgColor ? 'customBgColor' : '']" :style="{ lineHeight: height - 2 + 'px', padding: 0 }" :hover-stop-propagation="true" hover-class="thover" @click="handleClick" :form-type="formType" :open-type="openType" @getphonenumber="getphonenumber">
6 months ago
<view class="g_flex_row_center">
6 months ago
<view class="g_flex_column_center g_mr_4" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
6 months ago
<view class="g_flex_column_center" v-if="icon">
<view class="iconfont icon" :class="icon"></view>
</view>
6 months ago
<view class="g_flex_column_center" :class="'g_fs_' + fontSize">
6 months ago
{{ btnText }}
</view>
</view>
</button>
</view>
</template>
<script>
/*
* @params size 尺寸
* medium
* default 默认
* small
* mini 迷你
* @params btnText 按钮文本
* @params mode 形状
* circle 胶囊式圆角square 圆角方形
* @parmas type 类型
* primary 主要按钮底色是主题色
* default 默认按钮底色是白色
6 months ago
* infro 信息按钮底色是灰色无法触发事件
6 months ago
* delete 删除按钮白底红色
* none 没有样式白底黑字
6 months ago
* disabled 禁用白底黑字
* @params openType 开放类型
6 months ago
* @params openType 开放类型
* @params icon 图标 项目id 4374774
6 months ago
* @params gradual 渐变背景色
* @params customBgColor 背景色
6 months ago
*/
export default {
props: {
6 months ago
gradual: {
type: String,
default: () => {
return "";
},
},
6 months ago
size: {
type: String,
default: () => {
return "default";
},
},
btnText: {
type: String,
default: () => {
return "按钮";
},
},
mode: {
type: String,
default: () => {
return "circle";
},
},
type: {
type: String,
default: () => {
return "default";
},
},
openType: {
type: String,
default: () => {
return "";
},
},
6 months ago
formType: {
type: String,
default: () => {
return "";
},
},
6 months ago
icon: {
type: String,
default: () => {
return "";
},
},
width: {
default: () => {
return "auto";
},
},
height: {
default: () => {
return "auto";
},
},
6 months ago
fontSize: {
default: () => {
return "16";
},
},
loading: {
default: () => {
return false;
},
},
customBgColor: {
default: () => {
return "";
},
},
6 months ago
},
methods: {
handleClick() {
this.$emit("clickBtn");
},
getphonenumber(e) {
this.$emit("clickTel", e);
},
},
};
</script>
<style lang="scss" scoped>
6 months ago
$main_color: #00b666;
.g_mr_4 {
margin-right: 4px;
}
.g_flex_column_center {
display: flex;
flex-direction: column;
justify-content: center;
}
.g_flex_row_center {
display: flex;
justify-content: center;
}
6 months ago
.g-components-button {
.bocai-btn {
width: 100%;
color: #ffffff;
box-sizing: border-box;
}
.bocai_btn_size {
&_medium {
height: 56px;
font-size: 18px;
line-height: 56px;
}
&_default {
width: 250px !important;
height: 42px;
font-size: 18px;
line-height: 42px;
.icon {
font-size: 27px;
}
&_auto {
width: 100%;
height: 42px;
font-size: 18px;
line-height: 42px;
}
}
&_small {
width: 120px !important;
height: 40px;
font-size: 16px;
line-height: 40px;
.icon {
font-size: 27px;
}
&_auto {
width: 100%;
height: 40px;
font-size: 16px;
line-height: 40px;
}
}
&_160 {
width: 160px !important;
height: 40px;
font-size: 16px;
line-height: 40px;
.icon {
font-size: 27px;
}
&_auto {
width: 100%;
height: 40px;
font-size: 16px;
line-height: 40px;
}
}
&_mini {
6 months ago
height: 28px !important;
padding: 0 12px !important;
font-size: 14px !important;
line-height: 28px !important;
6 months ago
.icon {
font-size: 12px;
}
}
6 months ago
&_height {
height: 40px;
font-size: 16px;
line-height: 40px;
.icon {
font-size: 27px;
}
&_auto {
width: 100%;
height: 40px;
font-size: 16px;
line-height: 40px;
}
}
6 months ago
}
.bocai_btn_mode {
&_circle {
border-radius: 60px;
}
&_square {
border-radius: 10px;
}
}
.bocai_btn_type {
&_primary {
6 months ago
background-color: $main_color;
6 months ago
color: #fff;
6 months ago
&.thover {
opacity: 0.8;
}
6 months ago
}
&_default {
background-color: #fff;
6 months ago
color: $main_color;
border: 1px solid $main_color;
6 months ago
&.thover {
opacity: 1;
6 months ago
background: #ddd;
6 months ago
}
}
&_infro {
pointer-events: none;
6 months ago
background: #ddd;
6 months ago
color: #666;
6 months ago
border: 0.5px solid #ddd;
6 months ago
&.thover {
background: #cccccc;
}
}
&_delete {
border: 1rpx solid #fff;
background-color: #fff;
color: #fa5151;
&.thover {
6 months ago
opacity: 1;
background-color: #f9f9f9;
border: 1rpx solid #f9f9f9;
6 months ago
}
}
&_none {
background-color: #fff;
color: #666;
border: 1rpx solid #ccc;
&.thover {
6 months ago
background-color: #ddd;
}
}
&_disabled {
background-color: rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.2);
&.thover {
// background-color: rgba(0, 0, 0, 0.05);
opacity: 1;
}
}
&_gradual {
background: v-bind("gradual");
color: #fff;
line-height: 24px !important;
opacity: 1;
&.thover {
opacity: 0.8;
6 months ago
}
}
}
6 months ago
.customBgColor {
background-color: v-bind("customBgColor");
color: #fff;
}
6 months ago
.g_w_260 {
width: 260px !important;
}
.g_h_48 {
height: 48px !important;
line-height: 48px !important;
}
}
</style>