Button组件-实现基本功能(Vue-UI组件库)

组件有添加新成员了,他就是基本的button,不做过多详述,仅仅记录一下防止忘记
暂时的功能:
1.输入size选择button组建的大小
2.输入样式改变button组件的颜色
3.一些基本的样式

<template>
    <div>
        <div
        :class="['zypc-button',btSize,btType]"
        >
            <span><slot></slot></span>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            buttonClass: 'zypc-button'
        }
    },
    props: ["size","type"],
    computed:{
        btSize:function(){
            return `${this.buttonClass}-${this.size}`
        },
        btType:function(){
            return `${this.buttonClass}-${this.type}`
        }
    }
}
</script>

<style lang="">
.zypc-button {
    padding:4px 25px; 
    margin:0px;
    border-radius: 10px;
    display:inline-block;  
    overflow:hidden;
    height: 32px;
    line-height:28px;
    background: rgb(45,183,245);
    color: white;
}
:hover.zypc-button {
    background: rgba(45,183,245,0.8);
    cursor: pointer;
}

/* 按钮大小 */
.zypc-button-small {
    height: 32px;
    line-height:28px;
}
.zypc-button-large {
    padding:4px 35px; 
    height: 45px;
    line-height: 41px;
}

/* 确认,蓝色按钮 */
.zypc-button-blue {
    background: rgb(45,183,245);
    color: white;
}
:hover.zypc-button-blue {
    background: rgba(45,183,245,0.8);
    cursor: pointer;
}

/* 错误,红色按钮 */
.zypc-button-error {
    background: rgb(235, 0, 18);
    color: white;
}
:hover.zypc-button-error {
    background:rgba(235, 0, 18,0.8);
    cursor: pointer;
}

/* 通过,绿色按钮 */
.zypc-button-success {
    background: rgb(127, 174, 66);
    color: white;
}
:hover.zypc-button-success {
    background: rgba(127, 174, 66, 0.8);
    cursor: pointer;
}
</style>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值