zyf-model-engine 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/build/getEnv.d.ts +13 -0
  2. package/build/plugins.d.ts +7 -0
  3. package/build/proxy.d.ts +11 -0
  4. package/index.html +2 -100
  5. package/manifest.webmanifest +1 -0
  6. package/package.json +3 -94
  7. package/registerSW.js +1 -0
  8. package/src/api/config/servicePort.d.ts +2 -0
  9. package/src/api/enums/httpEnum.d.ts +29 -0
  10. package/src/api/helper/axiosCancel.d.ts +21 -0
  11. package/src/api/helper/axiosFileCancel.d.ts +27 -0
  12. package/src/api/helper/checkStatus.d.ts +6 -0
  13. package/src/api/index.d.ts +26 -0
  14. package/src/api/interface/index.d.ts +18 -0
  15. package/src/components/CTree/interface/index.d.ts +6 -0
  16. package/src/components/Grid/interface/index.d.ts +5 -0
  17. package/src/components/ProTable/interface/index.d.ts +66 -0
  18. package/src/config/index.d.ts +5 -0
  19. package/src/config/nprogress.d.ts +3 -0
  20. package/src/config/piniaPersist.d.ts +10 -0
  21. package/src/config/serviceLoading.d.ts +5 -0
  22. package/src/enums/httpEnum.d.ts +19 -0
  23. package/src/hooks/interface/index.d.ts +30 -0
  24. package/src/hooks/useOnline.d.ts +6 -0
  25. package/src/hooks/useTable.d.ts +47 -0
  26. package/src/main.d.ts +1 -0
  27. package/src/stores/commonStore.d.ts +2 -0
  28. package/src/stores/index.d.ts +2 -0
  29. package/src/stores/interface/index.d.ts +1 -0
  30. package/src/utils/color.d.ts +28 -0
  31. package/src/utils/commonUtils.d.ts +63 -0
  32. package/src/utils/errorHandler.d.ts +5 -0
  33. package/src/utils/is.d.ts +82 -0
  34. package/src/utils/layoutUtils.d.ts +44 -0
  35. package/src/utils/localUtils.d.ts +24 -0
  36. package/src/utils/serviceDict.d.ts +7 -0
  37. package/style.css +1 -0
  38. package/sw.js +1 -0
  39. package/vite.config.d.ts +2 -0
  40. package/workbox-3e911b1d.js +1 -0
  41. package/zyf-model-engine.mjs +45118 -0
  42. package/zyf-model-engine.umd.js +81 -0
  43. package/.editorconfig +0 -15
  44. package/.env +0 -13
  45. package/.env.development +0 -20
  46. package/.env.production +0 -25
  47. package/.env.test +0 -25
  48. package/.eslintignore +0 -15
  49. package/.eslintrc-auto-import.json +0 -65
  50. package/.eslintrc.cjs +0 -66
  51. package/.husky/commit-msg +0 -4
  52. package/.husky/pre-commit +0 -5
  53. package/.prettierignore +0 -9
  54. package/.prettierrc.cjs +0 -41
  55. package/.stylelintignore +0 -4
  56. package/.stylelintrc.cjs +0 -40
  57. package/.vscode/extensions.json +0 -14
  58. package/.vscode/settings.json +0 -92
  59. package/CHANGELOG.md +0 -246
  60. package/LICENSE +0 -21
  61. package/README.md +0 -205
  62. package/auto-imports.d.ts +0 -132
  63. package/build/getEnv.ts +0 -46
  64. package/build/plugins.ts +0 -138
  65. package/build/proxy.ts +0 -28
  66. package/commitlint.config.cjs +0 -84
  67. package/components.d.ts +0 -28
  68. package/lint-staged.config.cjs +0 -8
  69. package/postcss.config.cjs +0 -5
  70. package/src/App.vue +0 -16
  71. package/src/api/config/servicePort.ts +0 -3
  72. package/src/api/enums/httpEnum.ts +0 -35
  73. package/src/api/helper/axiosCancel.ts +0 -50
  74. package/src/api/helper/axiosFileCancel.ts +0 -62
  75. package/src/api/helper/checkStatus.ts +0 -97
  76. package/src/api/index.ts +0 -142
  77. package/src/api/interface/index.ts +0 -27
  78. package/src/assets/global-icons/icon-demo.svg +0 -1
  79. package/src/assets/iconfont/iconfont.scss +0 -44
  80. package/src/assets/iconfont/iconfont.ttf +0 -0
  81. package/src/assets/images/empty-img.png +0 -0
  82. package/src/assets/option-icons/add.svg +0 -1
  83. package/src/assets/option-icons/check.svg +0 -1
  84. package/src/assets/option-icons/config.svg +0 -1
  85. package/src/assets/option-icons/del.svg +0 -1
  86. package/src/assets/option-icons/detail.svg +0 -1
  87. package/src/assets/option-icons/edit.svg +0 -2
  88. package/src/assets/option-icons/export.svg +0 -1
  89. package/src/assets/option-icons/folder.svg +0 -1
  90. package/src/assets/option-icons/full-screen.svg +0 -1
  91. package/src/assets/option-icons/more.svg +0 -1
  92. package/src/assets/option-icons/return.svg +0 -1
  93. package/src/assets/option-icons/search.svg +0 -1
  94. package/src/components/CSvgIcon/index.scss +0 -23
  95. package/src/components/CSvgIcon/index.vue +0 -74
  96. package/src/components/CTree/index.scss +0 -48
  97. package/src/components/CTree/index.vue +0 -176
  98. package/src/components/CTree/interface/index.ts +0 -6
  99. package/src/components/Dialog/index.scss +0 -74
  100. package/src/components/Dialog/index.vue +0 -87
  101. package/src/components/Empty/index.scss +0 -16
  102. package/src/components/Empty/index.vue +0 -43
  103. package/src/components/Grid/components/GridItem.vue +0 -68
  104. package/src/components/Grid/index.vue +0 -167
  105. package/src/components/Grid/interface/index.ts +0 -6
  106. package/src/components/Loading/index.scss +0 -67
  107. package/src/components/Loading/index.vue +0 -13
  108. package/src/components/Overflow/index.vue +0 -76
  109. package/src/components/ProTable/components/ColSetting.vue +0 -45
  110. package/src/components/ProTable/components/Pagination.vue +0 -29
  111. package/src/components/ProTable/components/SearchForm/components/SearchFormItem.vue +0 -93
  112. package/src/components/ProTable/components/SearchForm/index.scss +0 -12
  113. package/src/components/ProTable/components/SearchForm/index.vue +0 -91
  114. package/src/components/ProTable/components/TableColumn.vue +0 -56
  115. package/src/components/ProTable/index.scss +0 -14
  116. package/src/components/ProTable/index.vue +0 -274
  117. package/src/components/ProTable/interface/index.ts +0 -86
  118. package/src/components/ScrollBox/index.vue +0 -44
  119. package/src/components/SvgIcon/index.vue +0 -20
  120. package/src/components/Tabs/index.vue +0 -142
  121. package/src/config/index.ts +0 -12
  122. package/src/config/nprogress.ts +0 -12
  123. package/src/config/piniaPersist.ts +0 -19
  124. package/src/config/serviceLoading.ts +0 -45
  125. package/src/enums/httpEnum.ts +0 -24
  126. package/src/hooks/interface/index.ts +0 -32
  127. package/src/hooks/useOnline.ts +0 -27
  128. package/src/hooks/useTable.ts +0 -167
  129. package/src/main.ts +0 -35
  130. package/src/plugins/button/button.vue +0 -56
  131. package/src/plugins/index.js +0 -26
  132. package/src/plugins/index.vue +0 -24
  133. package/src/plugins/msg/msg.vue +0 -56
  134. package/src/stores/commonStore.ts +0 -9
  135. package/src/stores/index.ts +0 -8
  136. package/src/stores/interface/index.ts +0 -1
  137. package/src/styles/common.scss +0 -87
  138. package/src/styles/element.scss +0 -233
  139. package/src/styles/reset.scss +0 -20
  140. package/src/styles/var.scss +0 -2
  141. package/src/typings/global.d.ts +0 -37
  142. package/src/typings/window.d.ts +0 -8
  143. package/src/utils/color.ts +0 -59
  144. package/src/utils/commonUtils.ts +0 -175
  145. package/src/utils/errorHandler.ts +0 -28
  146. package/src/utils/is.ts +0 -147
  147. package/src/utils/layoutUtils.ts +0 -83
  148. package/src/utils/localUtils.ts +0 -42
  149. package/src/utils/serviceDict.ts +0 -9
  150. package/src/vite-env.d.ts +0 -6
  151. package/tsconfig.json +0 -50
  152. package/vite.config.ts +0 -76
  153. /package/{public/logo.png → logo.png} +0 -0
@@ -1,20 +0,0 @@
1
- <template>
2
- <svg class="icon" :style="iconStyle" aria-hidden="true">
3
- <use :xlink:href="symbolId" />
4
- </svg>
5
- </template>
6
-
7
- <script setup lang="ts" name="SvgIcon">
8
- import { computed, CSSProperties } from "vue";
9
- interface SvgProps {
10
- name: string; // 图标的名称 ==> 必传
11
- prefix?: string; // 图标的前缀 ==> 非必传(默认为"icon")
12
- iconStyle?: CSSProperties; // 图标的样式 ==> 非必传
13
- }
14
- const props = withDefaults(defineProps<SvgProps>(), {
15
- prefix: "icon",
16
- iconStyle: () => ({ width: "1em", height: "1em" })
17
- });
18
- const symbolId = computed(() => `#${props.prefix}-${props.name}`);
19
- </script>
20
- <style></style>
@@ -1,142 +0,0 @@
1
- <template>
2
- <div :class="{ 'full-box': full, tab: true }">
3
- <el-tabs
4
- v-if="tabPans?.length"
5
- ref="tabsRef"
6
- :model-value="activeName"
7
- @tab-click="onTabClick"
8
- @tab-change="onTabChange"
9
- :before-leave="onBeforeLeave"
10
- @tab-remove="onRemoveTab"
11
- v-bind="config"
12
- >
13
- <div class="tab-pane-class" style="width: 100%; height: 100%">
14
- <el-tab-pane
15
- v-for="(item, index) in tabPans as any"
16
- :key="index"
17
- :lazy="lazy"
18
- :label="item[prop.label]"
19
- :name="item[prop.name] ?? index"
20
- :disabled="item.disabled"
21
- >
22
- <template #label v-if="item?.labelRender || item?.useLabel">
23
- <component v-if="item?.labelRender" :is="item?.labelRender" v-bind="item"> </component>
24
- <slot v-if="item?.useLabel" :label="item[prop.label]" :pane-name="item[prop.name] ?? index" :item="item" />
25
- </template>
26
- <slot
27
- v-if="[item[prop.name], index].includes(activeName)"
28
- :item="item"
29
- :index="index"
30
- :key="item[prop.name] ?? index"
31
- />
32
- </el-tab-pane>
33
- </div>
34
- </el-tabs>
35
- <empty v-else />
36
- </div>
37
- </template>
38
- <script setup lang="ts">
39
- const props = defineProps({
40
- full: {
41
- type: Boolean,
42
- default: () => true
43
- },
44
-
45
- tabPans: {
46
- type: Array,
47
- required: true
48
- },
49
- activeName: {
50
- type: [Number, String],
51
- default: () => 0
52
- },
53
- config: {
54
- type: Object,
55
- default: () => {}
56
- },
57
- // 配置选项
58
- prop: {
59
- type: Object,
60
- default: () => {
61
- return {
62
- label: "name",
63
- name: "id"
64
- };
65
- }
66
- },
67
-
68
- // 标签是否延迟渲染
69
- lazy: {
70
- type: Boolean,
71
- default: () => true
72
- },
73
- beforeLeave: {
74
- type: Function,
75
- default: () => {
76
- return true;
77
- }
78
- }
79
- });
80
- const emit = defineEmits(["onTabClick", "onTabChange", "onRemoveTab"]);
81
-
82
- const onBeforeLeave = async (activeName: any, oldActiveName: any) => {
83
- return await props.beforeLeave(activeName, oldActiveName);
84
- };
85
- const onTabClick = (pane: any, e: any) => {
86
- emit("onTabClick", pane.props.name, pane, e);
87
- };
88
- const onTabChange = (name: any) => {
89
- emit("onTabChange", name);
90
- };
91
- const onRemoveTab = (name: any) => {
92
- emit("onRemoveTab", name);
93
- };
94
- const tabsRef = ref();
95
- defineExpose({ tabsRef });
96
- </script>
97
- <style lang="scss" scoped>
98
- .tab {
99
- :deep(.el-tabs) {
100
- .el-tabs__nav {
101
- .el-tabs__item {
102
- font-size: 14px;
103
- font-weight: 500;
104
- color: #8c9094;
105
- }
106
- .is-active {
107
- font-family: MiSans-Regular, MiSans;
108
- font-size: 14px;
109
- font-weight: 400;
110
- color: $primary-color;
111
- }
112
- .el-tabs__active-bar {
113
- background-color: $primary-color;
114
- }
115
- .is-disabled {
116
- color: #d7d7d7;
117
- cursor: not-allowed;
118
- }
119
- }
120
- .el-tabs__nav-wrap::after {
121
- display: none;
122
- }
123
- }
124
- }
125
- .full-box {
126
- height: 100%;
127
- :deep(.el-tabs) {
128
- display: flex;
129
- flex-direction: column;
130
- height: 100%;
131
- .el-tabs__content {
132
- flex: 1;
133
- .el-tab-pane {
134
- height: 100%;
135
- .main {
136
- height: 100%;
137
- }
138
- }
139
- }
140
- }
141
- }
142
- </style>
@@ -1,12 +0,0 @@
1
- // ? 全局默认配置项
2
- // 项目名称区分 智能建造基础版
3
- export const DEMO_KEY: string = import.meta.env.VITE_GLOB_DEMO_KEY as string;
4
- export const TITLE: string = import.meta.env.VITE_GLOB_APP_TITLE as string;
5
-
6
- // 默认主题颜色
7
- export const DEFAULT_PRIMARY: string = "#00A5A7";
8
-
9
- // 路由白名单地址(必须是本地存在的路由 staticRouter.ts 中)
10
- export const ROUTER_WHITE_LIST: string[] = ["/500"];
11
-
12
- export const USE_LOCAL_FILE_ROUTER = true;
@@ -1,12 +0,0 @@
1
- import NProgress from "nprogress";
2
- import "nprogress/nprogress.css";
3
-
4
- NProgress.configure({
5
- easing: "ease", // 动画方式
6
- speed: 500, // 递增进度条的速度
7
- showSpinner: true, // 是否显示加载ico
8
- trickleSpeed: 200, // 自动递增间隔
9
- minimum: 0.3 // 初始化时的最小百分比
10
- });
11
-
12
- export default NProgress;
@@ -1,19 +0,0 @@
1
- import { PersistedStateOptions } from "pinia-plugin-persistedstate";
2
- import { DEMO_KEY } from "./index";
3
- /**
4
- * @description pinia 持久化参数配置
5
- * @param {String} key 存储到持久化的 name
6
- * @param {Array} paths 需要持久化的 state name
7
- * @return persist
8
- * */
9
- const piniaPersistConfig = (key: string, paths?: string[]) => {
10
- const persist: PersistedStateOptions = {
11
- key: DEMO_KEY + key,
12
- storage: localStorage,
13
- // storage: sessionStorage,
14
- paths
15
- };
16
- return persist;
17
- };
18
-
19
- export default piniaPersistConfig;
@@ -1,45 +0,0 @@
1
- import { ElLoading } from "element-plus";
2
-
3
- /* 全局请求 loading */
4
- let loadingInstance: ReturnType<typeof ElLoading.service>;
5
-
6
- /**
7
- * @description 开启 Loading
8
- * */
9
- const startLoading = () => {
10
- loadingInstance = ElLoading.service({
11
- fullscreen: true,
12
- lock: true,
13
- text: "Loading",
14
- background: "rgba(0, 0, 0, 0.7)"
15
- });
16
- };
17
-
18
- /**
19
- * @description 结束 Loading
20
- * */
21
- const endLoading = () => {
22
- loadingInstance.close();
23
- };
24
-
25
- /**
26
- * @description 显示全屏加载
27
- * */
28
- let needLoadingRequestCount = 0;
29
- export const showFullScreenLoading = () => {
30
- if (needLoadingRequestCount === 0) {
31
- startLoading();
32
- }
33
- needLoadingRequestCount++;
34
- };
35
-
36
- /**
37
- * @description 隐藏全屏加载
38
- * */
39
- export const tryHideFullScreenLoading = () => {
40
- if (needLoadingRequestCount <= 0) return;
41
- needLoadingRequestCount--;
42
- if (needLoadingRequestCount === 0) {
43
- endLoading();
44
- }
45
- };
@@ -1,24 +0,0 @@
1
- /**
2
- * @description:请求方法
3
- */
4
- export enum RequestEnum {
5
- GET = "GET",
6
- POST = "POST",
7
- PATCH = "PATCH",
8
- PUT = "PUT",
9
- DELETE = "DELETE"
10
- }
11
-
12
- /**
13
- * @description:常用的 contentTyp 类型
14
- */
15
- export enum ContentTypeEnum {
16
- // json
17
- JSON = "application/json;charset=UTF-8",
18
- // text
19
- TEXT = "text/plain;charset=UTF-8",
20
- // form-data 一般配合qs
21
- FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
22
- // form-data 上传
23
- FORM_DATA = "multipart/form-data;charset=UTF-8"
24
- }
@@ -1,32 +0,0 @@
1
- export namespace Table {
2
- export interface Pageable {
3
- page: number;
4
- limit: number;
5
- total: number;
6
- }
7
- export interface StateProps {
8
- tableData: any[];
9
- pageable: Pageable;
10
- searchParam: {
11
- [key: string]: any;
12
- };
13
- searchInitParam: {
14
- [key: string]: any;
15
- };
16
- totalParam: {
17
- [key: string]: any;
18
- };
19
- icon?: {
20
- [key: string]: any;
21
- };
22
- }
23
- }
24
-
25
- export namespace HandleData {
26
- export type MessageType = "" | "success" | "warning" | "info" | "error";
27
- }
28
-
29
- export namespace Theme {
30
- export type ThemeType = "light" | "inverted" | "dark";
31
- export type GreyOrWeakType = "grey" | "weak";
32
- }
@@ -1,27 +0,0 @@
1
- import { ref, onMounted, onUnmounted } from "vue";
2
-
3
- /**
4
- * @description 网络是否可用
5
- * */
6
- export const useOnline = () => {
7
- const online = ref(true);
8
- const showStatus = (val: any) => {
9
- online.value = typeof val == "boolean" ? val : val.target.online;
10
- };
11
- // 在页面加载后,设置正确的网络状态
12
- navigator.onLine ? showStatus(true) : showStatus(false);
13
-
14
- onMounted(() => {
15
- // 开始监听网络状态的变化
16
- window.addEventListener("online", showStatus);
17
- window.addEventListener("offline", showStatus);
18
- });
19
-
20
- onUnmounted(() => {
21
- // 移除监听网络状态的变化
22
- window.removeEventListener("online", showStatus);
23
- window.removeEventListener("offline", showStatus);
24
- });
25
-
26
- return { online };
27
- };
@@ -1,167 +0,0 @@
1
- import { Table } from "./interface";
2
- import { http } from "@/api/index";
3
- import { fetchType } from "@/api/interface/index";
4
- /**
5
- * @description table 页面操作方法封装
6
- * @param {Function} api 获取表格数据 api 方法 (必传)
7
- * @param {Object} initParam 获取数据初始化参数 (非必传,默认为{})
8
- * @param {Boolean} isPageable 是否有分页 (非必传,默认为true)
9
- * @param {Function} dataCallBack 对后台返回的数据进行处理的方法 (非必传)
10
- * */
11
- export const useTable = (
12
- initParam: object = {},
13
- isPageable: boolean = true,
14
- fetchType: fetchType,
15
- tableLimit: number = 10,
16
- api?: string | ((params: any) => Promise<any>),
17
-
18
- dataCallBack?: (data: any) => any,
19
- requestError?: (error: any) => void
20
- ) => {
21
- const state = reactive<Table.StateProps>({
22
- // 表格数据
23
- tableData: [],
24
- // 分页数据
25
- pageable: {
26
- // 当前页数
27
- page: 1,
28
- // 每页显示条数
29
- limit: tableLimit,
30
- // // 总条数
31
- total: 0
32
- },
33
- // 查询参数(只包括查询)
34
- searchParam: {},
35
- // 初始化默认的查询参数
36
- searchInitParam: {},
37
- // 总参数(包含分页和查询参数)
38
- totalParam: {}
39
- });
40
-
41
- /**
42
- * @description 分页查询参数(只包括分页和表格字段排序,其他排序方式可自行配置)
43
- * */
44
- const pageParam = computed({
45
- get: () => {
46
- return {
47
- page: state.pageable.page,
48
- limit: state.pageable.limit
49
- };
50
- },
51
- set: (newVal: any) => {
52
- console.log("我是分页更新之后的值", newVal);
53
- }
54
- });
55
-
56
- /**
57
- * @description 获取表格数据
58
- * @return void
59
- * */
60
- const getTableList = async () => {
61
- if (!api) return;
62
- try {
63
- // 先把初始化参数和分页参数放到总参数里面
64
- Object.assign(state.totalParam, initParam, isPageable ? pageParam.value : {});
65
-
66
- let data =
67
- typeof api === "string"
68
- ? await http[fetchType](api, { params: { ...state.searchInitParam, ...state.totalParam } })
69
- : await api({ params: { ...state.searchInitParam, ...state.totalParam } });
70
-
71
- dataCallBack && (data = await dataCallBack(data));
72
- state.tableData = data.items || data;
73
- // 解构后台返回的分页数据 (如果有分页更新分页信息)
74
- if (isPageable) {
75
- const { total } = data;
76
- updatePageable({ ...pageParam.value, total });
77
- }
78
- } catch (error) {
79
- requestError && requestError(error);
80
- }
81
- };
82
-
83
- /**
84
- * @description 更新查询参数
85
- * @return void
86
- * */
87
- const updatedTotalParam = () => {
88
- state.totalParam = {};
89
- // 处理查询参数,可以给查询参数加自定义前缀操作
90
- let nowSearchParam: Table.StateProps["searchParam"] = {};
91
- // 防止手动清空输入框携带参数(这里可以自定义查询参数前缀)
92
- for (let key in state.searchParam) {
93
- // * 某些情况下参数为 false/0 也应该携带参数
94
- if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) {
95
- nowSearchParam[key] = state.searchParam[key];
96
- }
97
- }
98
-
99
- // , isPageable ? pageParam.value : {}
100
- Object.assign(state.totalParam, nowSearchParam);
101
- };
102
-
103
- /**
104
- * @description 更新分页信息
105
- * @param {Object} pageable 后台返回的分页数据
106
- * @return void
107
- * */
108
- const updatePageable = (pageable: Table.Pageable) => {
109
- Object.assign(state.pageable, pageable);
110
- };
111
-
112
- /**
113
- * @description 表格数据查询
114
- * @return void
115
- * */
116
- const search = () => {
117
- state.pageable.page = 1;
118
- updatedTotalParam();
119
- getTableList();
120
- };
121
-
122
- /**
123
- * @description 表格数据重置
124
- * @return void
125
- * */
126
- const reset = () => {
127
- state.pageable.page = 1;
128
- state.searchParam = {};
129
- // 重置搜索表单的时,如果有默认搜索参数,则重置默认的搜索参数
130
- Object.keys(state.searchInitParam).forEach(key => {
131
- state.searchParam[key] = state.searchInitParam[key];
132
- });
133
- updatedTotalParam();
134
- getTableList();
135
- };
136
-
137
- /**
138
- * @description 每页条数改变
139
- * @param {Number} val 当前条数
140
- * @return void
141
- * */
142
- const handleSizeChange = (val: number) => {
143
- state.pageable.page = 1;
144
- state.pageable.limit = val;
145
- getTableList();
146
- };
147
-
148
- /**
149
- * @description 当前页改变
150
- * @param {Number} val 当前页
151
- * @return void
152
- * */
153
- const handleCurrentChange = (val: number) => {
154
- state.pageable.page = val;
155
- getTableList();
156
- };
157
-
158
- return {
159
- ...toRefs(state),
160
- getTableList,
161
- search,
162
- reset,
163
- handleSizeChange,
164
- handleCurrentChange,
165
- updatedTotalParam
166
- };
167
- };
package/src/main.ts DELETED
@@ -1,35 +0,0 @@
1
- import { createApp, VueElement } from "vue";
2
- import App from "./App.vue";
3
-
4
- // reset style sheet
5
- import "@/styles/reset.scss";
6
- import "@/styles/element.scss";
7
- import "@/styles/reset.scss";
8
-
9
- // element dark css
10
- import "element-plus/theme-chalk/dark/css-vars.css";
11
-
12
- // element css
13
- import "element-plus/dist/index.css";
14
- // custom element css
15
- import "@/styles/element.scss";
16
- // svg icons
17
- import "virtual:svg-icons-register";
18
- // element plus
19
- import ElementPlus from "element-plus";
20
- // element icons
21
- import * as Icons from "@element-plus/icons-vue";
22
- // pinia store
23
- import pinia from "@/stores";
24
-
25
- const app = createApp(App);
26
- Object.keys(Icons).forEach(key => {
27
- app.component(key, Icons[key as keyof typeof Icons]);
28
- });
29
-
30
- // errorHandler;
31
- import errorHandler from "@/utils/errorHandler";
32
- app.config.errorHandler = errorHandler;
33
-
34
- import vueMsg from "./plugins/index.js";
35
- app.use(ElementPlus).use(vueMsg).use(pinia).mount("#app");
@@ -1,56 +0,0 @@
1
- <template>
2
- <button class="btn">
3
- <span>
4
- <!-- 自定义插槽 -->
5
- <slot></slot>
6
- </span>
7
- </button>
8
- </template>
9
- <script setup></script>
10
-
11
- <script>
12
- export default {
13
- //一定要写组件名
14
- name: "VueButton"
15
- };
16
- </script>
17
-
18
- <style scoped>
19
- .btn {
20
- display: inline-block;
21
- width: 200px;
22
- padding: 18px;
23
- margin: 5px;
24
- font-size: 28px;
25
- font-weight: 400;
26
- color: #ffffffff;
27
- text-align: center;
28
- vertical-align: middle;
29
- cursor: pointer;
30
- background-color: #f4511e;
31
- border: none;
32
- border-radius: 20px;
33
- transition: all 0.5s;
34
- }
35
- .btn span {
36
- position: relative;
37
- display: inline-block;
38
- cursor: pointer;
39
- transition: 0.5s;
40
- }
41
- .btn span::after {
42
- position: absolute;
43
- top: 0;
44
- right: -20px;
45
- content: ">";
46
- opacity: 0;
47
- transition: 0.5s;
48
- }
49
- .btn:hover span {
50
- padding-right: 30px;
51
- }
52
- .btn:hover span::after {
53
- right: 0;
54
- opacity: 1;
55
- }
56
- </style>
@@ -1,26 +0,0 @@
1
- //入口文件=>插件的入口=>统一管理文件
2
- //动态引入文件
3
- const requireComponent = import.meta.glob("./**/*.vue", { eager: true });
4
- const install = Vue => {
5
- console.log(requireComponent);
6
-
7
- Object.keys(requireComponent).forEach(fileName => {
8
- //第i个组件
9
- const config = requireComponent[fileName];
10
- //组件名 刚才写的组件名派上用场了
11
- const conponentName = config.default.name;
12
-
13
- Vue.component(conponentName, config.default || config);
14
- });
15
- //这里也可以创建全局自定义指令 这里是创建了一个自动获取焦点的指令
16
- Vue.directive("focus", {
17
- mounted: function (el) {
18
- el.focus();
19
- }
20
- });
21
- };
22
-
23
- //对外暴露install方法
24
- export default {
25
- install
26
- };
@@ -1,24 +0,0 @@
1
- <template>
2
- <input v-model="text" type="text" v-focus />
3
- <vue-button @click="submit">123</vue-button>
4
- <vue-msg ref="msg"></vue-msg>
5
- </template>
6
-
7
- <script setup>
8
- import { nextTick, ref } from "vue";
9
- let msg = ref();
10
- let text = ref("");
11
- function submit() {
12
- if (text.value !== "") {
13
- nextTick(() => {
14
- msg.value.msgPlugin("提交成功", 1000);
15
- });
16
- } else {
17
- nextTick(() => {
18
- msg.value.msgPlugin("输入不能为空", 1000);
19
- });
20
- }
21
- }
22
- </script>
23
-
24
- <style scoped></style>