Blame view

local/routers/msg.vue 1.34 KB
7c15ac9e   梁灏   add Message compo...
1
2
3
4
5
  <template>
      <Button @click="info">info</Button>
      <Button @click="success">success</Button>
      <Button @click="error">error</Button>
      <Button @click="warning">warning</Button>
47e58396   梁灏   message component...
6
      <Button @click="loading">手动消失</Button>
7c15ac9e   梁灏   add Message compo...
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
  </template>
  <script>
      import { Message, Button } from 'iview';
  
      export default {
          components: {
              Message,
              Button
          },
          props: {
          
          },
          data () {
              return {
              
              }
          },
          computed: {
  
          },
          methods: {
              info () {
                  Message.info('欢迎来到iView', 3, () => {
                      console.log('close info');
                  });
              },
              success () {
                  Message.success('成功啦', 5, () => {
                      console.log('close successs');
                  });
              },
              error () {
                  Message.error('错误啦');
              },
              warning () {
                  Message.warning('来个警告');
              },
              loading () {
47e58396   梁灏   message component...
45
46
47
                  const hide = Message.loading('我是loading', 0);
  
                  setTimeout(hide, 5000);
7c15ac9e   梁灏   add Message compo...
48
49
50
              }
          },
          ready () {
47e58396   梁灏   message component...
51
52
53
54
  //            Message.config({
  //                top: 50,
  //                duration: 8
  //            });
7c15ac9e   梁灏   add Message compo...
55
56
57
          }
      }
  </script>