Commit 75c32564f0fce4e9e16ba24fc7148e23c364d6d6

Authored by Aresn
1 parent e4e8711d

fixed #646

Showing 2 changed files with 13 additions and 34 deletions   Show diff stats
examples/routers/badge.vue
@@ -14,37 +14,24 @@ @@ -14,37 +14,24 @@
14 </style> 14 </style>
15 <template> 15 <template>
16 <div> 16 <div>
17 - <Badge count="3"> 17 + <Badge dot :count="count">
18 <a href="#" class="demo-badge"></a> 18 <a href="#" class="demo-badge"></a>
19 </Badge> 19 </Badge>
20 - <Badge dot>  
21 - <a href="#" class="demo-badge"></a>  
22 - </Badge>  
23 - <Badge dot>  
24 - <Icon type="ios-bell-outline" size="26"></Icon>  
25 - </Badge>  
26 - <Badge dot>  
27 - <a href="#">可以是一个链接</a>  
28 - </Badge>  
29 - <Badge count="100">  
30 - <a href="#" class="demo-badge"></a>  
31 - </Badge>  
32 - <Badge count="1000" overflow-count="999">  
33 - <a href="#" class="demo-badge"></a>  
34 - </Badge>  
35 - <br>  
36 - <Badge count="10"></Badge>  
37 - <br><br>  
38 - <Badge count="20" class-name="demo-badge-alone"></Badge> 20 + <Button @click="setCount">set count</Button>
39 </div> 21 </div>
40 </template> 22 </template>
41 <script> 23 <script>
42 export default { 24 export default {
43 props: {}, 25 props: {},
44 data () { 26 data () {
45 - return {}; 27 + return {
  28 + count: 50
  29 + };
46 }, 30 },
47 - computed: {},  
48 - methods: {} 31 + methods: {
  32 + setCount () {
  33 + this.count = 10;
  34 + }
  35 + }
49 }; 36 };
50 </script> 37 </script>
51 \ No newline at end of file 38 \ No newline at end of file
src/components/badge/badge.vue
@@ -61,17 +61,9 @@ @@ -61,17 +61,9 @@
61 } 61 }
62 62
63 return status; 63 return status;
64 - }  
65 - },  
66 - data () {  
67 - return {  
68 - alone: false  
69 - };  
70 - },  
71 - mounted () {  
72 - const child_length = this.$refs.badge.children.length;  
73 - if (child_length === 1) {  
74 - this.alone = true; 64 + },
  65 + alone () {
  66 + return this.$slots.default === undefined;
75 } 67 }
76 } 68 }
77 }; 69 };