Blame view

examples/routers/modal.vue 1.71 KB
6259471f   梁灏   support Modal
1
2
  <template>
      <div>
7c41ecb3   梁灏   fixed #1099
3
4
          <i-button @click="modal=true">show modal</i-button>
          <Modal v-model="modal" @on-ok="resetForm" @on-cancel="resetForm" title="表单">
f03c4e64   梁灏   Modal update widt...
5
              <div>
7c41ecb3   梁灏   fixed #1099
6
7
8
                  <i-select ref="formSelect" filterable remote clearable :remote-method="remoteMethod" :loading="loading">
                      <i-option v-for="option in options" :value="option.value" :key="option.value">{{option.label}}</i-option>
                  </i-select>
f03c4e64   梁灏   Modal update widt...
9
              </div>
dce5a3ea   Aresn   update Modal
10
          </Modal>
6259471f   梁灏   support Modal
11
12
13
14
      </div>
  </template>
  <script>
      export default {
dce5a3ea   Aresn   update Modal
15
16
          data () {
              return {
7c41ecb3   梁灏   fixed #1099
17
18
19
20
21
22
23
24
25
26
27
28
29
                  modal: false,
                  loading: false,
                  options: [],
                  cityList: [
                      {
                          value: "beijing",
                          label: "北京市"
                      },
                      {
                          value: "shanghai",
                          label: "上海市"
                      }
                  ]
dce5a3ea   Aresn   update Modal
30
31
              }
          },
6259471f   梁灏   support Modal
32
          methods: {
dce5a3ea   Aresn   update Modal
33
34
35
36
37
38
              ok () {
                  this.$Message.info('点击了确定');
              },
              cancel () {
                  this.$Message.info('点击了取消');
              },
7c41ecb3   梁灏   fixed #1099
39
40
41
42
43
44
45
46
47
48
49
50
51
              remoteMethod(query) {
                  this.loading = true;
                  setTimeout(() => {
                      this.loading = false;
                      this.options = this.cityList;
                  }, 200);
              },
              resetForm() {
                  //加个计时器,就能解决这个定位问题了
                  // setTimeout(()=> {
                  this.$refs["formSelect"].clearSingleSelect();
                  this.options = [];
                  // }, 300)
6259471f   梁灏   support Modal
52
53
54
55
              }
          }
      }
  </script>