Commit 207d6b072bc37c166052fd8d9af26481848cf836

Authored by 梁灏
1 parent 0f512d6a

update Cascader Icons

examples/routers/cascader.vue
1 <template> 1 <template>
2 - <div>  
3 - <Cascader v-model="value3" :data="data" filterable style="width: 400px"></Cascader>  
4 - <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>  
5 - <Cascader v-model="value3" :data="data" filterable style="width: 400px"></Cascader>  
6 - <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>  
7 - <Cascader v-model="value3" :data="data" filterable style="width: 400px"></Cascader>  
8 - </div> 2 + <Cascader :data="data4" :load-data="loadData"></Cascader>
9 </template> 3 </template>
10 <script> 4 <script>
11 export default { 5 export default {
12 data () { 6 data () {
13 return { 7 return {
14 - data: [{  
15 - value: 1,  
16 - label: '北京',  
17 - children: [  
18 - {  
19 - value: 11,  
20 - label: '故宫'  
21 - },  
22 - {  
23 - value: 12,  
24 - label: '天坛'  
25 - },  
26 - {  
27 - value: 13,  
28 - label: '王府井'  
29 - }  
30 - ]  
31 - }, {  
32 - value: 2,  
33 - label: '江苏',  
34 - children: [  
35 - {  
36 - value: 21,  
37 - label: '南京',  
38 - children: [  
39 - {  
40 - value: 211,  
41 - label: '夫子庙',  
42 - }  
43 - ]  
44 - },  
45 - {  
46 - value: 22,  
47 - label: '苏州',  
48 - children: [  
49 - {  
50 - value: 221,  
51 - label: '拙政园',  
52 - },  
53 - {  
54 - value: 222,  
55 - label: '狮子林',  
56 - }  
57 - ]  
58 - }  
59 - ],  
60 - }],  
61 - value3: [] 8 + data4: [
  9 + {
  10 + value: 'beijing',
  11 + label: '北京',
  12 + children: [],
  13 + loading: false
  14 + },
  15 + {
  16 + value: 'hangzhou',
  17 + label: '杭州',
  18 + children: [],
  19 + loading:false
  20 + }
  21 + ]
  22 + }
  23 + },
  24 + methods: {
  25 + loadData (item, callback) {
  26 + item.loading = true;
  27 + setTimeout(() => {
  28 + if (item.value === 'beijing') {
  29 + item.children = [
  30 + {
  31 + value: 'talkingdata',
  32 + label: 'TalkingData'
  33 + },
  34 + {
  35 + value: 'baidu',
  36 + label: '百度'
  37 + },
  38 + {
  39 + value: 'sina',
  40 + label: '新浪'
  41 + }
  42 + ];
  43 + } else if (item.value === 'hangzhou') {
  44 + item.children = [
  45 + {
  46 + value: 'ali',
  47 + label: '阿里巴巴'
  48 + },
  49 + {
  50 + value: '163',
  51 + label: '网易'
  52 + }
  53 + ];
  54 + }
  55 + item.loading = false;
  56 + callback();
  57 + }, 1000);
62 } 58 }
63 } 59 }
64 } 60 }
src/components/cascader/cascader.vue
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 :class="[prefixCls + '-label']" 16 :class="[prefixCls + '-label']"
17 v-show="filterable && query === ''" 17 v-show="filterable && query === ''"
18 @click="handleFocus">{{ displayRender }}</div> 18 @click="handleFocus">{{ displayRender }}</div>
19 - <Icon type="ios-close" :class="[prefixCls + '-arrow']" v-show="showCloseIcon" @click.native.stop="clearSelect"></Icon>  
20 - <Icon type="arrow-down-b" :class="[prefixCls + '-arrow']"></Icon> 19 + <Icon type="ios-close-circle" :class="[prefixCls + '-arrow']" v-show="showCloseIcon" @click.native.stop="clearSelect"></Icon>
  20 + <Icon type="ios-arrow-down" :class="[prefixCls + '-arrow']"></Icon>
21 </slot> 21 </slot>
22 </div> 22 </div>
23 <transition name="transition-drop"> 23 <transition name="transition-drop">
src/components/cascader/casitem.vue
1 <template> 1 <template>
2 <li :class="classes"> 2 <li :class="classes">
3 {{ data.label }} 3 {{ data.label }}
4 - <i v-if="showArrow" class="ivu-icon ivu-icon-ios-arrow-right"></i>  
5 - <i v-if="showLoading" class="ivu-icon ivu-icon-load-c ivu-load-loop"></i> 4 + <i v-if="showArrow" class="ivu-icon ivu-icon-ios-arrow-forward"></i>
  5 + <i v-if="showLoading" class="ivu-icon ivu-icon-ios-sync ivu-load-loop"></i>
6 </li> 6 </li>
7 </template> 7 </template>
8 <script> 8 <script>