diff --git a/docs/examples-docs/badge.md b/docs/examples-docs/badge.md index fee5fda1e..e08f6d46b 100644 --- a/docs/examples-docs/badge.md +++ b/docs/examples-docs/badge.md @@ -4,11 +4,26 @@ :::demo 样例代码 ```html - - - - - + + + + + ``` -::: \ No newline at end of file +::: + +### z-badge-group API + +| 参数 | 说明 | 类型 | 默认值 | 必须型 | +|-----------|-----------|-----------|-------------|-------------| +| active-key | 激活的badge的索引 | string | '0'但必须子badge里的mark是有0位索引 | | + + +### z-badge API +| 参数 | 说明 | 类型 | 默认值 | 可选值 | +|-----------|-----------|-----------|-------------|-------------| +| mark | badge的唯一key值 | string | '' | required | +| title | badge的文案标题 | string | '' | required | +| info | 当前badge的提示消息数量 | string | '' | | +| url | 跳转链接 | string | 全连接直接跳转或者hash | | diff --git a/packages/badge/mixin/emitter.js b/packages/badge/mixin/emitter.js deleted file mode 100644 index 2e25c831f..000000000 --- a/packages/badge/mixin/emitter.js +++ /dev/null @@ -1,34 +0,0 @@ -function broadcast(componentName, eventName, ...params) { - this.$children.forEach(child => { - var name = child.$options.componentName; - - if (name === componentName) { - child.$emit.apply(child, [eventName].concat(params)); - } else { - broadcast.apply(child, [componentName, eventName].concat(params)); - } - }); -} -export default { - methods: { - $dispatch(componentName, eventName, ...params) { - - var parent = this.$parent || this.$root; - var name = parent.$options.componentName; - - while (parent && (!name || name !== componentName)) { - parent = parent.$parent; - - if (parent) { - name = parent.$options.componentName; - } - } - if (parent) { - parent.$emit.apply(parent, [eventName].concat(params)); - } - }, - $broadcast(componentName, eventName, ...params) { - broadcast.call(this, componentName, eventName, ...params); - } - } -}; diff --git a/packages/badge/src/badge-group.vue b/packages/badge/src/badge-group.vue index 231a60f9c..1339100fb 100644 --- a/packages/badge/src/badge-group.vue +++ b/packages/badge/src/badge-group.vue @@ -7,9 +7,16 @@