plopfile.mjs 843 B

12345678910111213141516171819202122232425262728293031
  1. /** @param {import("plop").NodePlopAPI} plop */
  2. export default function (plop) {
  3. plop.setGenerator("curd-list", {
  4. description: "列表页骨架:PageSearch + PageContent + CrudToolbarLeft/Right + useCrudList",
  5. prompts: [
  6. {
  7. type: "input",
  8. name: "modulePath",
  9. message: "views 下路径(如 module_example/demo)",
  10. },
  11. {
  12. type: "input",
  13. name: "componentName",
  14. message: "组件 name(PascalCase,如 Demo)",
  15. },
  16. {
  17. type: "input",
  18. name: "permPrefix",
  19. message: "权限前缀(如 module_example:demo)",
  20. },
  21. ],
  22. actions: [
  23. {
  24. type: "add",
  25. path: "src/views/{{modulePath}}/index.vue",
  26. templateFile: "plop-templates/curd-list-page.vue.hbs",
  27. skipIfExists: true,
  28. },
  29. ],
  30. });
  31. }