Blame view

examples/routers/modal.vue 1.55 KB
6259471f   梁灏   support Modal
1
2
  <template>
      <div>
e5337c81   梁灏   fixed some compon...
3
4
5
          <Button @click="confirm">标准</Button>
          <Button @click="custom">自定义按钮文字</Button>
          <Button @click="async">异步关闭</Button>
6259471f   梁灏   support Modal
6
7
8
9
      </div>
  </template>
  <script>
      export default {
6259471f   梁灏   support Modal
10
          methods: {
e5337c81   梁灏   fixed some compon...
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
              confirm () {
                  this.$Modal.confirm({
                      title: '确认对话框标题',
                      content: '<p>一些对话框内容</p><p>一些对话框内容</p>',
                      onOk: () => {
                          this.$Message.info('点击了确定');
                      },
                      onCancel: () => {
                          this.$Message.info('点击了取消');
                      }
                  });
              },
              custom () {
                  this.$Modal.confirm({
                      title: '确认对话框标题',
                      content: '<p>一些对话框内容</p><p>一些对话框内容</p>',
                      okText: 'OK',
                      cancelText: 'Cancel'
                  });
              },
              async () {
                  this.$Modal.confirm({
                      title: '确认对话框标题',
                      content: '<p>对话框将在 2秒 后关闭</p>',
                      loading: true,
                      onOk: () => {
                          setTimeout(() => {
                              this.$Modal.remove();
                              this.$Message.info('异步关闭了对话框');
                          }, 2000);
                      }
                  });
6259471f   梁灏   support Modal
43
44
45
46
              }
          }
      }
  </script>