Blame view

examples/routers/select.vue 6.17 KB
89828b5b   梁灏   update Select
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  <!--<template>-->
      <!--<div>-->
          <!--{{ model10 }} - -->
          <!--{{ model11 }}-->
          <!--<Select v-model="model10" style="width:260px">-->
              <!--<Option v-for="(item, index) in cityList" :value="item.value" :key="index">{{ item.label }}</Option>-->
          <!--</Select>-->
          <!--<Select v-model="model11" style="width:260px">-->
              <!--<Option v-for="(item, index) in cityList" :value="item.value" :key="index">{{ item.label }}</Option>-->
          <!--</Select>-->
      <!--</div>-->
  <!--</template>-->
  <!--<script>-->
      <!--export default {-->
          <!--data () {-->
              <!--return {-->
                  <!--cityList: [],-->
                  <!--model10: '',-->
                  <!--model11: '',-->
                  <!--model12: ''-->
              <!--}-->
          <!--},-->
          <!--mounted () {-->
              <!--setTimeout(() => {-->
                  <!--this.cityList = [-->
                      <!--{-->
                          <!--value: 'beijing',-->
                          <!--label: '北京市'-->
                      <!--},-->
                      <!--{-->
                          <!--value: 'shanghai',-->
                          <!--label: '上海市'-->
                      <!--},-->
                      <!--{-->
                          <!--value: 'shenzhen',-->
                          <!--label: '深圳市'-->
                      <!--},-->
                      <!--{-->
                          <!--value: 'hangzhou',-->
                          <!--label: '杭州市'-->
                      <!--},-->
                      <!--{-->
                          <!--value: 'nanjing',-->
                          <!--label: '南京市'-->
                      <!--},-->
                      <!--{-->
                          <!--value: 'chongqing',-->
                          <!--label: '重庆市'-->
                      <!--}-->
                  <!--];-->
              <!--}, 1000);-->
          <!--}-->
      <!--}-->
  <!--</script>-->
  
e1b86bcf   梁灏   fixed #1865
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  <!--<template>-->
      <!--<div>-->
          <!--<Select v-model="value">-->
              <!--<Option v-for="item in list" :value="item.value" :label="item.label" :key="item.value"></Option>-->
          <!--</Select>-->
          <!--<Button @click="setList">set list</Button>-->
      <!--</div>-->
  <!--</template>-->
  <!--<script>-->
      <!--export default {-->
          <!--data () {-->
              <!--return {-->
                  <!--value: '',-->
                  <!--list: []-->
              <!--}-->
          <!--},-->
          <!--methods: {-->
              <!--setList () {-->
                  <!--let list = [];-->
                  <!--for (let i = 0; i < 400; i++) {-->
                      <!--list.push({-->
                          <!--value: 'value' + i,-->
                          <!--label: 'label' + i-->
                      <!--});-->
                  <!--}-->
                  <!--this.list = list;-->
              <!--}-->
          <!--}-->
      <!--}-->
  <!--</script>-->
  
e355dd49   梁灏   add Select Component
87
  <template>
e1b86bcf   梁灏   fixed #1865
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
      <div style="width: 400px;margin: 50px;">
          <div>data: {{ model13 }}</div>
          <Row>
              <Col span="12" style="padding-right:10px">
              <Select
                      v-model="model13"
                      filterable
                      remote
                      :remote-method="remoteMethod1"
                      :loading="loading1">
                  <Option v-for="(option, index) in options1" :value="option.value" :key="index">{{option.label}}</Option>
              </Select>
              </Col>
              <Col span="12">
              <Select
                      v-model="model14"
                      multiple
                      filterable
                      remote
                      :remote-method="remoteMethod2"
                      :loading="loading2">
                  <Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option>
              </Select>
              </Col>
          </Row>
60314959   梁灏   fixed #1743 and c...
113
      </div>
e355dd49   梁灏   add Select Component
114
  </template>
e355dd49   梁灏   add Select Component
115
  <script>
e355dd49   梁灏   add Select Component
116
      export default {
e355dd49   梁灏   add Select Component
117
118
          data () {
              return {
e1b86bcf   梁灏   fixed #1865
119
120
121
122
123
124
125
                  model13: '',
                  loading1: false,
                  options1: [],
                  model14: [],
                  loading2: false,
                  options2: [],
                  list: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New hampshire', 'New jersey', 'New mexico', 'New york', 'North carolina', 'North dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode island', 'South carolina', 'South dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West virginia', 'Wisconsin', 'Wyoming']
89828b5b   梁灏   update Select
126
127
128
              }
          },
          methods: {
e1b86bcf   梁灏   fixed #1865
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
              remoteMethod1 (query) {
                  if (query !== '') {
                      this.loading1 = true;
                      setTimeout(() => {
                          this.loading1 = false;
                          const list = this.list.map(item => {
                              return {
                                  value: item,
                                  label: item
                              };
                          });
                          this.options1 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1);
                      }, 200);
                  } else {
                      this.options1 = [];
                  }
              },
              remoteMethod2 (query) {
                  if (query !== '') {
                      this.loading2 = true;
                      setTimeout(() => {
                          this.loading2 = false;
                          const list = this.list.map(item => {
                              return {
                                  value: item,
                                  label: item
                              };
                          });
                          this.options2 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1);
                      }, 200);
                  } else {
                      this.options2 = [];
89828b5b   梁灏   update Select
161
                  }
e355dd49   梁灏   add Select Component
162
              }
e355dd49   梁灏   add Select Component
163
164
          }
      }
e1b86bcf   梁灏   fixed #1865
165
  </script>