仿写elementUI的按钮组件

1.button.vue

<style lang="scss" scoped>
    .defalut{
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        background: #fff;
        border: 1px solid #dcdfe6;
        color: #606266;
        -webkit-appearance: none;
        text-align: center;
        box-sizing: border-box;
        outline: none;
        margin: 0;
        transition: .1s;
        font-weight: 500;
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 4px;
    }
    .primary{
        color: #fff;
        background-color: #409eff;
        border-color: #409eff;
    }
    .success{
        color: #fff;
        background-color: #67c23a;
        border-color: #67c23a;
    }
</style>

<template>
    <button class="defalut" :class="type">
        <slot>
            按钮
        </slot>
    </button>
</template>
<script>
export default {
    props:{
        type:{
            type:String,
            default:''
        }
    }
}
</script>

2.使用

        <v-button type='primary'>主要按钮</v-button>
        <v-button type='success'>成功按钮</v-button>

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值