index.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import "xe-utils";
  2. import { App } from "vue";
  3. import { i18n } from "/@/plugins/i18n";
  4. import "font-awesome/css/font-awesome.min.css";
  5. import {
  6. // 核心
  7. VXETable,
  8. // 表格功能
  9. Header,
  10. Footer,
  11. Icon,
  12. Filter,
  13. Edit,
  14. Menu,
  15. Export,
  16. Keyboard,
  17. Validator,
  18. // 可选组件
  19. Column,
  20. Colgroup,
  21. Grid,
  22. Tooltip,
  23. Toolbar,
  24. Pager,
  25. Form,
  26. FormItem,
  27. FormGather,
  28. Checkbox,
  29. CheckboxGroup,
  30. Radio,
  31. RadioGroup,
  32. RadioButton,
  33. Switch,
  34. Input,
  35. Select,
  36. Optgroup,
  37. Option,
  38. Textarea,
  39. Button,
  40. Modal,
  41. List,
  42. Pulldown,
  43. // 表格
  44. Table
  45. } from "vxe-table";
  46. // 全局默认参数
  47. VXETable.setup({
  48. size: "medium",
  49. version: 0,
  50. zIndex: 1002,
  51. table: {
  52. // 自动监听父元素的变化去重新计算表格
  53. autoResize: true,
  54. // 鼠标移到行是否要高亮显示
  55. highlightHoverRow: true
  56. },
  57. input: {
  58. clearable: true
  59. },
  60. // 对组件内置的提示语进行国际化翻译
  61. // @ts-ignore
  62. i18n: (key, args) => i18n.global.t(key, args),
  63. // 可选,对参数中的列头、校验提示..等进行自动翻译(只对支持国际化的有效)
  64. translate(key, args) {
  65. // 例如,只翻译 "buttons." 开头的键值
  66. if (key && key.indexOf("buttons.") > -1) {
  67. return i18n.global.t(key, args);
  68. }
  69. if (key && key.indexOf("el.") > -1) {
  70. return i18n.global.t(key, args);
  71. }
  72. return key;
  73. }
  74. });
  75. export function useTable(app: App) {
  76. app
  77. .use(Header)
  78. .use(Footer)
  79. .use(Icon)
  80. .use(Filter)
  81. .use(Edit)
  82. .use(Menu)
  83. .use(Export)
  84. .use(Keyboard)
  85. .use(Validator)
  86. // 可选组件
  87. .use(Column)
  88. .use(Colgroup)
  89. .use(Grid)
  90. .use(Tooltip)
  91. .use(Toolbar)
  92. .use(Pager)
  93. .use(Form)
  94. .use(FormItem)
  95. .use(FormGather)
  96. .use(Checkbox)
  97. .use(CheckboxGroup)
  98. .use(Radio)
  99. .use(RadioGroup)
  100. .use(RadioButton)
  101. .use(Switch)
  102. .use(Input)
  103. .use(Select)
  104. .use(Optgroup)
  105. .use(Option)
  106. .use(Textarea)
  107. .use(Button)
  108. .use(Modal)
  109. .use(List)
  110. .use(Pulldown)
  111. // 安装表格
  112. .use(Table);
  113. }