myButton.vue 1.1 KB
<template>
	<view class="my_button" :class="{border, size: size === 'small'}" :style="{background: bgColor, color}" @click="comfirn">
		{{ title }}
	</view>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				require: true
			},
			color: {
				type: String,
				default: '#fff'
			},
			size: {
				type: String,
				default: 'normal'
			},
			bgColor: {
				type: String,
				default: ''
			},
			border: {
				type: Boolean,
				default: false
			}
		},
		methods: {
			comfirn(){
				this.$emit('comfirn')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.my_button{
		box-sizing: border-box;
		background: linear-gradient( 270deg, $uni-color-primary 0%, #FCD723 100%);
		border-radius: 112rpx;
		text-align: center;
		line-height: 80rpx;
		color: #fff;
		font-size: 28rpx;
		&.border{
			border: 2rpx solid $uni-color-primary;;
		}
	}
	.size{
		padding: 8rpx 34rpx;
		text-align: center;
		color: #fff;
		font-size: 24rpx;
		line-height: 40rpx;
		background: linear-gradient( 270deg, $uni-color-primary 0%, #FCD723 100%);
		border-radius: 112rpx;
		box-sizing: border-box;
	}
</style>