diff --git a/examples/views/docs/component/tag.md b/examples/views/docs/component/tag.md index 48ab0e6..0869e16 100644 --- a/examples/views/docs/component/tag.md +++ b/examples/views/docs/component/tag.md @@ -4,38 +4,100 @@ ## 基础用法 -标签说明 +默认为线框类型,配置`radius`属性改变圆角属性,配置`font-color`属性改变字体和线框颜色 -::: snippet 示例 +::: snippet 注意:配置`radius`时需要加上单位 ```html +``` + +::: + +## 填充效果 + +配置`type`属性改变填充类型,配置`fill-color`改变填充类型颜色 + +::: snippet 支持`fill`, `ghost`,默认为`ghost` + +```html + +``` + +::: + +## 特殊标签 + +特殊业务需求下的标签,配置`shape`属性改变类型 + +::: snippet 支持`coupon`, `quarter`, `bubble`, `dot` + +```html + +``` + +::: - +## 圆点类型 + +配置`shape`属性为`dot`时为圆点类型,配置`dot-size`属性自定义圆点大小 + +::: snippet 注意:圆点类型宽高一致,如有内容时应注意内容溢出 + +```html + ``` -::: \ No newline at end of file +::: + +## API + +## Attribute 属性 + +参数|说明|类型|可选值|默认值 +-|-|-|-|- +size | 大小 | String | tiny, small, large | large +shape | 形状 | String | square, circle, fillet, quarter, coupon, bubble | square +sharp | 尖角| String | top-left, top-right, bottom-left, bottom-right | - +type | 类型 | String | fill ghost | ghost +fillColor | 填充颜色 | String | - | rgba(0,0,0,0) +fontWeight | 字体粗细 | String | normal, bold, bolder | normal +fontColor | 字体颜色 | String | - | - +dotSize | 园点大小 | String | - | - +radius | 圆角大小 | String | - | - + +## Events 事件 + +事件名称|说明|回调参数 +-|-|- +click | 按钮点击事件 | - \ No newline at end of file diff --git a/packages/tag/index.css b/packages/tag/index.css index 5369c51..b85adeb 100644 --- a/packages/tag/index.css +++ b/packages/tag/index.css @@ -9,6 +9,15 @@ color: rgba(231, 64, 33, 1); border-color: rgba(231, 64, 33, 1); } +.zui-tag .shape-dot { + border-radius: 50%; + height: 16px; + width: 16px; +} +.zui-tag .shape-dot.size-tiny { + height: 8px; + width: 8px; +} .zui-tag .shape-square { padding: 0 6px; border-radius: 50%; @@ -125,10 +134,9 @@ } .zui-tag .type-fill { color: #fff; - background: rgba(231, 64, 33, 1); } .zui-tag .type-ghost { - border: 1px solid rgba(231, 64, 33, 1); + border: 1px solid #ff5151; background: rgba(0,0,0,0); } .zui-tag .font-weight-normal { diff --git a/packages/tag/index.vue b/packages/tag/index.vue index 4a4ed74..e2a3c5f 100644 --- a/packages/tag/index.vue +++ b/packages/tag/index.vue @@ -60,7 +60,9 @@ export default { fontColor: { type: String, default: "" - } + }, + dotSize: String, + radius: String, }, data: function() { return { @@ -98,7 +100,14 @@ export default { var style = {}; if (this.type == "fill") { // eslint-disable-next-line - this.fillColor && (style.background = this.fillColor); + style.background = this.fillColor || '#ff5151'; + } + if (this.shape == 'dot') { + style.height = this.dotSize; + style.width = this.dotSize; + style.display = 'flex'; + style.alignItems = 'center'; + style.justifyContent = 'center'; } if (this.fontColor) { if (this.type == "ghost") { @@ -106,6 +115,9 @@ export default { } style.color = this.fontColor; } + if (this.radius) { + style.borderRadius = this.radius; + } return style; }, leftCoupon: function() { -- libgit2 0.21.0