Blame view

local/routers/notice.vue 1.98 KB
40f8606f   梁灏   add Notice component
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  <template>
      <Alert type="success" show-icon closable>
          成功提示文案
          <span slot="desc">成功的提示描述文案成功的提示描述文案成功的提示描述文案成功的提示描述文案成功的提示描述文案</span>
      </Alert>
      <Button @click="open">open</Button>
      <Button @click="close">close key = key111</Button>
      <Button @click="destroy">destroy</Button>
  </template>
  <script>
      import { Notice, Button, Message, Alert } from 'iview';
  
      export default {
          components: { Notice, Button, Alert },
          props: {
          
          },
          data () {
              return {
                  key: 'key111'
              }
          },
          computed: {
          
          },
          methods: {
              open () {
                  const title = '这是通知的标题';
                  const desc = '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述';
  
                  Notice.open({
                      title: title,
                      desc: desc,
                  });
                  Notice.info({
                      title: title,
                      desc: desc,
                  });
                  Notice.success({
                      title: title,
                      desc: desc,
                      key: this.key
                  });
                  Notice.warning({
                      title: title,
                      desc: desc,
                  });
                  Notice.error({
                      title: title,
                      desc: desc,
                  });
                  Message.info('放假海口市', 0);
              },
              close () {
                  Notice.close(this.key);
              },
              destroy () {
                  Notice.destroy();
              }
          },
          ready () {
  //            this.open();
              Notice.config({
                  top: 1,
                  duration: 0
              })
          }
      }
  </script>