原生按钮封装

1.button.vue

<template>
	<button class="yh-button" :disabled="disabled" @click="onClick($event)">
		<slot></slot>
	</button>
</template>
<script>
 export default {
   name: 'Button',
   data() {
		 return {
     }
	 },
	 props:["disabled"],
	 methods : {
		 onClick(e) {
			 e.preventDefault();
			 e.stopPropagation();
			 this.$emit('click', e);
		 }
   },
	 created () {
	 },
	 mounted () {
	 }
 }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.yh-button {
	line-height: 1;
    height:36px;
    white-space: nowrap;
    cursor: pointer;
    background: #fff;
    border: 1px solid $primary-color;
	border-radius:2px;	
    color: $primary-color;
    -webkit-appearance: none;
    text-align: center;
    box-sizing: border-box;
    outline: none;
    margin: 0;
    font-weight: 500;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    padding: 8px 20px;
    font-size: 14px;	
}

.yh-button:active {
	border-color:$border-hl-color;
}
 </style>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值