Blame view

examples/routers/select.vue 1.8 KB
e355dd49   梁灏   add Select Component
1
  <template>
60314959   梁灏   fixed #1743 and c...
2
3
4
5
6
7
8
9
      <div>
          <h4>有remote属性</h4>
          {{ selectedIds }}
          <i-select remote clearable filterable multiple :label="selectedLabel" v-model="selectedIds" style='margin-bottom:20px;'>
              <i-option v-for="option in list" :value="option.id" :key="option.id">{{option.name}}</i-option>
          </i-select>
          <i-button @click="setVal3">设置3</i-button>
      </div>
e355dd49   梁灏   add Select Component
10
  </template>
e355dd49   梁灏   add Select Component
11
  <script>
e355dd49   梁灏   add Select Component
12
      export default {
e355dd49   梁灏   add Select Component
13
14
          data () {
              return {
60314959   梁灏   fixed #1743 and c...
15
16
17
                  list: [],
                  selectedIds: [],
                  selectedLabel: []
e355dd49   梁灏   add Select Component
18
              }
60314959   梁灏   fixed #1743 and c...
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
56
          },
          methods: {
              setVal1: function () {
                  this.selectedLabel = ['几何', '化学'];
                  this.selectedIds = ['201701041343', '201701011541']
  
              },
              setVal2: function () {
                  this.selectedLabel = ['政治', '英语', '数学'];
                  this.selectedIds = ['201701031442', '201701061244', '201701011145']
              },
              setVal3: function () {
                  this.selectedLabel = [];
                  this.selectedIds = [];
              }
          },
          mounted () {
              setTimeout(() => {
                  this.list = [{
                      name: '语文',
                      id: '201701011046'
                  }, {
                      name: '数学',
                      id: '201701011145'
                  }, {
                      name: '英语',
                      id: '201701061244'
                  }, {
                      name: '几何',
                      id: '201701041343'
                  }, {
                      name: '政治',
                      id: '201701031442'
                  }, {
                      name: '化学',
                      id: '201701011541'
                  }]
              }, 1000)
e355dd49   梁灏   add Select Component
57
58
          }
      }
219e5c92   梁灏   fixed #957
59
  </script>