tongshangming hai 1 ano
pai
achega
a98290d678

+ 1 - 1
plop-template/api.hbs

@@ -16,6 +16,6 @@ export function find(data: any) {
   return request.get('/find{{upperCase name}}', data)
 }
 
-export function get(data?: any) {
+export function getList(data?: any) {
   return request.get('/get{{upperCase name}}List', data)
 }

+ 9 - 0
plop-template/router.hbs

@@ -0,0 +1,9 @@
+  {
+    path: '/{{name}}',
+    name: '{{name}}',
+    component: () => import('@/views/{{properCase name}}.vue'),
+    meta: {
+      title: '',
+      icon: ''
+    }
+  },

+ 3 - 3
plop-template/service.hbs

@@ -13,15 +13,15 @@ export const use{{upperCase name}}Service = () => {
   const find = (data: any) => {
     return api.find(data)
   }
-  const get = (data: any) => {
-    return api.get(data)
+  const getList = (data: any) => {
+    return api.getList(data)
   }
 
   return {
     create,
     update,
     del,
-    get,
+    getList,
     find
   }
 }

+ 11 - 0
plop-template/view.hbs

@@ -0,0 +1,11 @@
+<script setup lang="ts">
+import { use{{upperCase name}}Service } from '@/domain/{{name}}/service'
+
+const {{camelCase name}}Service = use{{upperCase name}}Service()
+</script>
+
+<template>
+
+</template>
+
+<style lang="scss" scoped></style>

+ 11 - 0
plopfile.js

@@ -9,6 +9,11 @@ export default plop => {
       }
     ],
     actions: [
+      {
+        type: 'add',
+        path: 'src/views/{{properCase name}}.vue',
+        templateFile: 'plop-template/view.hbs'
+      },
       {
         type: 'add',
         path: 'src/domain/{{name}}/api.ts',
@@ -18,6 +23,12 @@ export default plop => {
         type: 'add',
         path: 'src/domain/{{name}}/service.ts',
         templateFile: 'plop-template/service.hbs'
+      },
+      {
+        type: 'append',
+        pattern: /(?=(\/\/ -- APPEND HERE --))/gi,
+        path: 'src/router/asyncRouter.ts',
+        templateFile: 'plop-template/router.hbs'
       }
     ]
   })

+ 1 - 0
src/router/asyncRouter.ts

@@ -10,6 +10,7 @@ const asyncRouter: RouteRecordRaw[] = [
       icon: 'House'
     }
   },
+  // -- APPEND HERE --
   {
     path: 'https://jijian.sxidc.com/',
     name: 'jijian',