diff --git a/examples/routers/badge.vue b/examples/routers/badge.vue index 241e267..7074ba1 100644 --- a/examples/routers/badge.vue +++ b/examples/routers/badge.vue @@ -14,37 +14,24 @@ </style> <template> <div> - <Badge count="3"> + <Badge dot :count="count"> <a href="#" class="demo-badge"></a> </Badge> - <Badge dot> - <a href="#" class="demo-badge"></a> - </Badge> - <Badge dot> - <Icon type="ios-bell-outline" size="26"></Icon> - </Badge> - <Badge dot> - <a href="#">可以是一个链接</a> - </Badge> - <Badge count="100"> - <a href="#" class="demo-badge"></a> - </Badge> - <Badge count="1000" overflow-count="999"> - <a href="#" class="demo-badge"></a> - </Badge> - <br> - <Badge count="10"></Badge> - <br><br> - <Badge count="20" class-name="demo-badge-alone"></Badge> + <Button @click="setCount">set count</Button> </div> </template> <script> export default { props: {}, data () { - return {}; + return { + count: 50 + }; }, - computed: {}, - methods: {} + methods: { + setCount () { + this.count = 10; + } + } }; </script> \ No newline at end of file diff --git a/src/components/badge/badge.vue b/src/components/badge/badge.vue index cc1880d..688b462 100644 --- a/src/components/badge/badge.vue +++ b/src/components/badge/badge.vue @@ -61,17 +61,9 @@ } return status; - } - }, - data () { - return { - alone: false - }; - }, - mounted () { - const child_length = this.$refs.badge.children.length; - if (child_length === 1) { - this.alone = true; + }, + alone () { + return this.$slots.default === undefined; } } }; -- libgit2 0.21.4