Browse Source

feat: add pageView actions callback

Sendya 5 years ago
parent
commit
70411641a0
2 changed files with 17 additions and 2 deletions
  1. 1 1
      src/layouts/PageView.vue
  2. 16 1
      src/views/list/CardList.vue

+ 1 - 1
src/layouts/PageView.vue

@@ -8,7 +8,7 @@
         <p style="font-size: 14px;color: rgba(0,0,0,.65)">{{ description }}</p>
         <div class="link">
           <template v-for="(link, index) in linkList">
-            <a :key="index" :href="link.href">
+            <a :key="index" @click="() => { link.callback && link.callback() }">
               <a-icon :type="link.icon" />
               <span>{{ link.title }}</span>
             </a>

+ 16 - 1
src/views/list/CardList.vue

@@ -49,13 +49,28 @@ export default {
     return {
       description: '段落示意:蚂蚁金服务设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态, 提供跨越设计与开发的体验解决方案。',
       linkList: [
-        { icon: 'rocket', href: '#', title: '快速开始' },
+        {
+          icon: 'rocket',
+          href: '#',
+          title: '快速开始',
+          // 回调,可不写
+          callback: () => {
+            // this.$message.info('快速开始被单击')
+            this.testFun()
+            console.log('call[\'快速开始\'] action')
+          }
+        },
         { icon: 'info-circle-o', href: '#', title: '产品简介' },
         { icon: 'file-text', href: '#', title: '产品文档' }
       ],
       extraImage: 'https://gw.alipayobjects.com/zos/rmsportal/RzwpdLnhmvDJToTdfDPe.png',
       dataSource
     }
+  },
+  methods: {
+    testFun () {
+      this.$message.info('快速开始被点击!')
+    }
   }
 }
 </script>