diff --git a/docs/examples-docs/badge.md b/docs/examples-docs/badge.md
index d86023622..c0a7b34f3 100644
--- a/docs/examples-docs/badge.md
+++ b/docs/examples-docs/badge.md
@@ -2,13 +2,28 @@
### 基础用法
+
+
:::demo 基础用法
```html
-
-
-
-
-
+
+
+
+
+
```
:::
diff --git a/packages/badge/src/badge-group.vue b/packages/badge/src/badge-group.vue
index e6998998e..7e98f52fb 100644
--- a/packages/badge/src/badge-group.vue
+++ b/packages/badge/src/badge-group.vue
@@ -14,12 +14,6 @@
type: [Number, String],
default: 0
}
- },
-
- data() {
- return {
- computedActiveKey: this.activeKey
- };
}
};
diff --git a/packages/badge/src/badge.vue b/packages/badge/src/badge.vue
index e0406b3c2..43f827f21 100644
--- a/packages/badge/src/badge.vue
+++ b/packages/badge/src/badge.vue
@@ -19,21 +19,27 @@ export default {
required: true
},
url: {
- type: String
+ type: String,
+ default: 'javascript:;'
},
info: {
type: String
}
},
methods: {
- handleClick() {
- this.$parent.computedActiveKey = this.mark;
+ handleClick(e) {
+ this.$emit('click', e, {
+ mark: this.mark,
+ title: this.title,
+ url: this.url,
+ info: this.info
+ });
}
},
computed: {
classNames() {
return {
- 'is-select': this.mark === this.$parent.computedActiveKey
+ 'is-select': this.mark === this.$parent.activeKey
};
}
}
diff --git a/packages/zanui-css/src/badge.css b/packages/zanui-css/src/badge.css
index 104cbd1a8..6c88ba3e3 100644
--- a/packages/zanui-css/src/badge.css
+++ b/packages/zanui-css/src/badge.css
@@ -13,14 +13,14 @@
display: block;
overflow: hidden;
position: relative;
- padding: 20px 15px;
+ padding: 20px 12px;
box-sizing: border-box;
- line-height: 14px;
+ line-height: 1.4;
background-color: $c-background;
color: $c-gray-darker;
font-size: 14px;
text-decoration: none;
- white-space: nowrap;
+ word-break: break-all;
@e active {
display: none;
position: absolute;
@@ -68,4 +68,4 @@
}
}
}
-}
\ No newline at end of file
+}