crud.code-snippets 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {
  2. "cl-crud": {
  3. "prefix": "cl-crud",
  4. "scope": "vue",
  5. "body": [
  6. "<template>",
  7. " <cl-crud ref=\"Crud\">",
  8. " <cl-row>",
  9. " <!-- 刷新按钮 -->",
  10. " <cl-refresh-btn />",
  11. " <!-- 新增按钮 -->",
  12. " <cl-add-btn />",
  13. " <!-- 删除按钮 -->",
  14. " <cl-multi-delete-btn />",
  15. " <cl-flex1 />",
  16. " <!-- 关键字搜索 -->",
  17. " <cl-search-key />",
  18. " </cl-row>",
  19. "",
  20. " <cl-row>",
  21. " <!-- 数据表格 -->",
  22. " <cl-table ref=\"Table\" />",
  23. " </cl-row>",
  24. "",
  25. " <cl-row>",
  26. " <cl-flex1 />",
  27. " <!-- 分页控件 -->",
  28. " <cl-pagination />",
  29. " </cl-row>",
  30. "",
  31. " <!-- 新增、编辑 -->",
  32. " <cl-upsert ref=\"Upsert\" />",
  33. " </cl-crud>",
  34. "</template>",
  35. "",
  36. "<script lang=\"ts\" name=\"菜单名称\" setup>",
  37. "import { useCrud, useTable, useUpsert } from \"@cool-vue/crud\";",
  38. "import { useCool } from \"/@/cool\";",
  39. "",
  40. "const { service } = useCool();",
  41. "",
  42. "// cl-upsert",
  43. "const Upsert = useUpsert({",
  44. " items: []",
  45. "});",
  46. "",
  47. "// cl-table",
  48. "const Table = useTable({",
  49. " columns: []",
  50. "});",
  51. "",
  52. "// cl-crud",
  53. "const Crud = useCrud(",
  54. " {",
  55. " service: service.demo.goods",
  56. " },",
  57. " (app) => {",
  58. " app.refresh();",
  59. " }",
  60. ");",
  61. "</script>",
  62. ""
  63. ],
  64. "description": "cl-crud snippets"
  65. }
  66. }