Commit 7469312ffcdaee6b097e7e5722b2a0ea8847193d

Authored by xingyu
Committed by GitHub
1 parent 401fcaf3

fix(Icon): Cannot access Icon before initialization #2680 (#2683)

* fix(Icon): Cannot access Icon before initialization

* fix(comps): import eslint

* fix(Icon): Cannot access Icon before initialization

* fix(comps): import eslint
Showing 46 changed files with 54 additions and 38 deletions
src/components/Application/src/search/AppSearchFooter.vue
... ... @@ -14,6 +14,7 @@
14 14 import AppSearchKeyItem from './AppSearchKeyItem.vue';
15 15 import { useDesign } from '/@/hooks/web/useDesign';
16 16 import { useI18n } from '/@/hooks/web/useI18n';
  17 +
17 18 const { prefixCls } = useDesign('app-search-footer');
18 19 const { t } = useI18n();
19 20 </script>
... ...
src/components/Application/src/search/AppSearchKeyItem.vue
... ... @@ -5,6 +5,7 @@
5 5 </template>
6 6 <script lang="ts" setup>
7 7 import { Icon } from '/@/components/Icon';
  8 +
8 9 defineProps({
9 10 icon: String,
10 11 });
... ...
src/components/Application/src/search/AppSearchModal.vue
... ... @@ -61,8 +61,7 @@
61 61 import { computed, unref, ref, watch, nextTick } from 'vue';
62 62 import { SearchOutlined } from '@ant-design/icons-vue';
63 63 import AppSearchFooter from './AppSearchFooter.vue';
64   - import Icon from '/@/components/Icon';
65   - // @ts-ignore
  64 + import { Icon } from '/@/components/Icon';
66 65 import vClickOutside from '/@/directives/clickOutside';
67 66 import { useDesign } from '/@/hooks/web/useDesign';
68 67 import { useRefs } from '/@/hooks/core/useRefs';
... ...
src/components/CardList/src/CardList.vue
... ... @@ -90,6 +90,7 @@
90 90 import { Button } from '/@/components/Button';
91 91 import { isFunction } from '/@/utils/is';
92 92 import { useSlider, grid } from './data';
  93 +
93 94 const ListItem = List.Item;
94 95 const CardMeta = Card.Meta;
95 96 const TypographyText = Typography.Text;
... ...
src/components/ClickOutSide/src/ClickOutSide.vue
... ... @@ -6,6 +6,7 @@
6 6 <script lang="ts" setup>
7 7 import { ref, onMounted } from 'vue';
8 8 import { onClickOutside } from '@vueuse/core';
  9 +
9 10 const emit = defineEmits(['mounted', 'clickOutside']);
10 11 const wrap = ref<ElRef>(null);
11 12  
... ...
src/components/ContextMenu/src/ContextMenu.vue
... ... @@ -2,7 +2,7 @@
2 2 import type { ContextMenuItem, ItemContentProps, Axis } from './typing';
3 3 import type { FunctionalComponent, CSSProperties, PropType } from 'vue';
4 4 import { defineComponent, nextTick, onMounted, computed, ref, unref, onUnmounted } from 'vue';
5   - import Icon from '/@/components/Icon';
  5 + import { Icon } from '/@/components/Icon';
6 6 import { Menu, Divider } from 'ant-design-vue';
7 7  
8 8 const prefixCls = 'context-menu';
... ...
src/components/Cropper/src/CropperAvatar.vue
... ... @@ -45,7 +45,7 @@
45 45 import { useMessage } from '/@/hooks/web/useMessage';
46 46 import { useI18n } from '/@/hooks/web/useI18n';
47 47 import type { ButtonProps } from '/@/components/Button';
48   - import Icon from '/@/components/Icon';
  48 + import { Icon } from '/@/components/Icon';
49 49  
50 50 const props = {
51 51 width: { type: [String, Number], default: '200px' },
... ...
src/components/Drawer/src/components/DrawerFooter.vue
... ... @@ -30,6 +30,7 @@
30 30 import { useDesign } from '/@/hooks/web/useDesign';
31 31  
32 32 import { footerProps } from '../props';
  33 +
33 34 export default defineComponent({
34 35 name: 'BasicDrawerFooter',
35 36 props: {
... ...
src/components/Drawer/src/components/DrawerHeader.vue
... ... @@ -25,6 +25,7 @@
25 25 import { useDesign } from '/@/hooks/web/useDesign';
26 26  
27 27 import { propTypes } from '/@/utils/propTypes';
  28 +
28 29 export default defineComponent({
29 30 name: 'BasicDrawerHeader',
30 31 components: { BasicTitle, ArrowLeftOutlined },
... ...
src/components/Excel/src/ImportExcel.vue
... ... @@ -18,6 +18,7 @@
18 18 import { dateUtil } from '/@/utils/dateUtil';
19 19  
20 20 import type { ExcelData } from './typing';
  21 +
21 22 export default defineComponent({
22 23 name: 'ImportExcel',
23 24 props: {
... ...
src/components/Form/src/components/ApiCascader.vue
... ... @@ -27,6 +27,7 @@
27 27 import { useRuleFormItem } from '/@/hooks/component/useFormItem';
28 28 import { LoadingOutlined } from '@ant-design/icons-vue';
29 29 import { useI18n } from '/@/hooks/web/useI18n';
  30 +
30 31 interface Option {
31 32 value: string;
32 33 label: string;
... ...
src/components/Form/src/components/ApiTransfer.vue
... ... @@ -19,6 +19,7 @@
19 19 import { propTypes } from '/@/utils/propTypes';
20 20 import { useI18n } from '/@/hooks/web/useI18n';
21 21 import { TransferDirection, TransferItem } from 'ant-design-vue/lib/transfer';
  22 +
22 23 export default defineComponent({
23 24 name: 'ApiTransfer',
24 25 components: { Transfer },
... ...
src/components/Form/src/components/ApiTree.vue
... ... @@ -16,6 +16,7 @@
16 16 import { get } from 'lodash-es';
17 17 import { propTypes } from '/@/utils/propTypes';
18 18 import { LoadingOutlined } from '@ant-design/icons-vue';
  19 +
19 20 export default defineComponent({
20 21 name: 'ApiTree',
21 22 components: { ATree: Tree, LoadingOutlined },
... ...
src/components/Form/src/components/ApiTreeSelect.vue
... ... @@ -16,6 +16,7 @@
16 16 import { get } from 'lodash-es';
17 17 import { propTypes } from '/@/utils/propTypes';
18 18 import { LoadingOutlined } from '@ant-design/icons-vue';
  19 +
19 20 export default defineComponent({
20 21 name: 'ApiTreeSelect',
21 22 components: { ATreeSelect: TreeSelect, LoadingOutlined },
... ...
src/components/Form/src/components/FormItem.vue
... ... @@ -2,7 +2,7 @@
2 2 import type { PropType, Ref } from 'vue';
3 3 import { computed, defineComponent, toRefs, unref } from 'vue';
4 4 import type { FormActionType, FormProps, FormSchema } from '../types/form';
5   - import type { ValidationRule } from 'ant-design-vue/lib/form/Form';
  5 + import type { Rule } from 'ant-design-vue/lib/form';
6 6 import type { TableActionType } from '/@/components/Table';
7 7 import { Col, Divider, Form } from 'ant-design-vue';
8 8 import { componentMap } from '../componentMap';
... ... @@ -138,7 +138,7 @@
138 138 return { isShow, isIfShow };
139 139 }
140 140  
141   - function handleRules(): ValidationRule[] {
  141 + function handleRules(): Rule[] {
142 142 const {
143 143 rules: defRules = [],
144 144 component,
... ... @@ -149,10 +149,10 @@
149 149 } = props.schema;
150 150  
151 151 if (isFunction(dynamicRules)) {
152   - return dynamicRules(unref(getValues)) as ValidationRule[];
  152 + return dynamicRules(unref(getValues)) as Rule[];
153 153 }
154 154  
155   - let rules: ValidationRule[] = cloneDeep(defRules) as ValidationRule[];
  155 + let rules: Rule[] = cloneDeep(defRules) as Rule[];
156 156 const { rulesMessageJoinLabel: globalRulesMessageJoinLabel } = props.formProps;
157 157  
158 158 const joinLabel = Reflect.has(props.schema, 'rulesMessageJoinLabel')
... ...
src/components/Icon/index.ts
... ... @@ -4,4 +4,4 @@ import IconPicker from &#39;./src/IconPicker.vue&#39;;
4 4  
5 5 export { Icon, IconPicker, SvgIcon };
6 6  
7   -export default Icon;
  7 +// export default Icon;
... ...
src/components/Loading/src/Loading.vue
... ... @@ -9,8 +9,7 @@
9 9 </section>
10 10 </template>
11 11 <script lang="ts">
12   - import { PropType } from 'vue';
13   - import { defineComponent } from 'vue';
  12 + import { PropType, defineComponent } from 'vue';
14 13 import { Spin } from 'ant-design-vue';
15 14 import { SizeEnum } from '/@/enums/sizeEnum';
16 15  
... ...
src/components/Markdown/src/MarkdownViewer.vue
... ... @@ -8,6 +8,7 @@
8 8 import { onMountedOrActivated } from '@vben/hooks';
9 9 import { useRootSetting } from '/@/hooks/setting/useRootSetting';
10 10 import { getTheme } from './getTheme';
  11 +
11 12 const props = defineProps({
12 13 value: { type: String },
13 14 class: { type: String },
... ...
src/components/Menu/src/components/BasicMenuItem.vue
... ... @@ -9,6 +9,7 @@
9 9 import { itemProps } from '../props';
10 10  
11 11 import MenuItemContent from './MenuItemContent.vue';
  12 +
12 13 export default defineComponent({
13 14 name: 'BasicMenuItem',
14 15 components: { MenuItem: Menu.Item, MenuItemContent },
... ...
src/components/Menu/src/components/MenuItemContent.vue
... ... @@ -7,10 +7,11 @@
7 7 <script lang="ts">
8 8 import { computed, defineComponent } from 'vue';
9 9  
10   - import Icon from '/@/components/Icon/index';
  10 + import { Icon } from '/@/components/Icon';
11 11 import { useI18n } from '/@/hooks/web/useI18n';
12 12 import { useDesign } from '/@/hooks/web/useDesign';
13 13 import { contentProps } from '../props';
  14 +
14 15 const { t } = useI18n();
15 16  
16 17 export default defineComponent({
... ...
src/components/Modal/src/components/ModalFooter.vue
... ... @@ -19,8 +19,8 @@
19 19 </template>
20 20 <script lang="ts">
21 21 import { defineComponent } from 'vue';
22   -
23 22 import { basicProps } from '../props';
  23 +
24 24 export default defineComponent({
25 25 name: 'BasicModalFooter',
26 26 props: basicProps,
... ...
src/components/Page/src/PageWrapper.vue
... ... @@ -33,7 +33,7 @@
33 33 </div>
34 34 </template>
35 35 <script lang="ts">
36   - import { CSSProperties, PropType, provide } from 'vue';
  36 + import type { CSSProperties, PropType, provide } from 'vue';
37 37  
38 38 import { defineComponent, computed, watch, ref, unref } from 'vue';
39 39 import PageFooter from './PageFooter.vue';
... ...
src/components/Scrollbar/src/Scrollbar.vue
... ... @@ -19,7 +19,6 @@
19 19 <script lang="ts">
20 20 import { addResizeListener, removeResizeListener } from '/@/utils/event';
21 21 import componentSetting from '/@/settings/componentSetting';
22   - const { scrollbar } = componentSetting;
23 22 import { toObject } from './util';
24 23 import {
25 24 defineComponent,
... ... @@ -33,6 +32,8 @@
33 32 } from 'vue';
34 33 import Bar from './bar';
35 34  
  35 + const { scrollbar } = componentSetting;
  36 +
36 37 export default defineComponent({
37 38 name: 'Scrollbar',
38 39 // inheritAttrs: false,
... ...
src/components/SimpleMenu/src/SimpleMenu.vue
... ... @@ -33,6 +33,7 @@
33 33 import { openWindow } from '/@/utils';
34 34  
35 35 import { useOpenKeys } from './useOpenKeys';
  36 +
36 37 export default defineComponent({
37 38 name: 'SimpleMenu',
38 39 components: {
... ...
src/components/SimpleMenu/src/SimpleSubMenu.vue
... ... @@ -48,7 +48,7 @@
48 48  
49 49 import { defineComponent, computed } from 'vue';
50 50 import { useDesign } from '/@/hooks/web/useDesign';
51   - import Icon from '/@/components/Icon/index';
  51 + import { Icon } from '/@/components/Icon';
52 52  
53 53 import MenuItem from './components/MenuItem.vue';
54 54 import SubMenu from './components/SubMenuItem.vue';
... ...
src/components/SimpleMenu/src/components/Menu.vue
... ... @@ -23,6 +23,7 @@
23 23 import { propTypes } from '/@/utils/propTypes';
24 24 import { createSimpleRootMenuContext } from './useSimpleMenuContext';
25 25 import mitt from '/@/utils/mitt';
  26 +
26 27 export default defineComponent({
27 28 name: 'Menu',
28 29 props: {
... ...
src/components/SimpleMenu/src/components/MenuItem.vue
... ... @@ -17,13 +17,14 @@
17 17 </template>
18 18  
19 19 <script lang="ts">
20   - import { PropType } from 'vue';
  20 + import type { PropType } from 'vue';
21 21 import { defineComponent, ref, computed, unref, getCurrentInstance, watch } from 'vue';
22 22 import { useDesign } from '/@/hooks/web/useDesign';
23 23 import { propTypes } from '/@/utils/propTypes';
24 24 import { useMenuItem } from './useMenu';
25 25 import { Tooltip } from 'ant-design-vue';
26 26 import { useSimpleRootMenuContext } from './useSimpleMenuContext';
  27 +
27 28 export default defineComponent({
28 29 name: 'MenuItem',
29 30 components: { Tooltip },
... ...
src/components/SimpleMenu/src/components/SubMenuItem.vue
... ... @@ -74,7 +74,7 @@
74 74 import { useMenuItem } from './useMenu';
75 75 import { useSimpleRootMenuContext } from './useSimpleMenuContext';
76 76 import { CollapseTransition } from '/@/components/Transition';
77   - import Icon from '/@/components/Icon';
  77 + import { Icon } from '/@/components/Icon';
78 78 import { Popover } from 'ant-design-vue';
79 79 import { isBoolean, isObject } from '/@/utils/is';
80 80 import mitt from '/@/utils/mitt';
... ...
src/components/Table/src/components/EditTableHeaderIcon.vue
... ... @@ -8,6 +8,7 @@
8 8 <script lang="ts">
9 9 import { defineComponent } from 'vue';
10 10 import { FormOutlined } from '@ant-design/icons-vue';
  11 +
11 12 export default defineComponent({
12 13 name: 'EditTableHeaderIcon',
13 14 components: { FormOutlined },
... ...
src/components/Table/src/components/TableAction.vue
... ... @@ -34,7 +34,7 @@
34 34 import { defineComponent, PropType, computed, toRaw, unref } from 'vue';
35 35 import { MoreOutlined } from '@ant-design/icons-vue';
36 36 import { Divider, Tooltip, TooltipProps } from 'ant-design-vue';
37   - import Icon from '/@/components/Icon/index';
  37 + import { Icon } from '/@/components/Icon';
38 38 import { ActionItem, TableActionType } from '/@/components/Table';
39 39 import { PopConfirmButton } from '/@/components/Button';
40 40 import { Dropdown } from '/@/components/Dropdown';
... ...
src/layouts/default/header/components/Breadcrumb.vue
... ... @@ -21,7 +21,7 @@
21 21 import { defineComponent, ref, watchEffect } from 'vue';
22 22  
23 23 import { Breadcrumb } from 'ant-design-vue';
24   - import Icon from '/@/components/Icon';
  24 + import { Icon } from '/@/components/Icon';
25 25  
26 26 import { useDesign } from '/@/hooks/web/useDesign';
27 27 import { useRootSetting } from '/@/hooks/setting/useRootSetting';
... ...
src/layouts/default/header/components/ErrorAction.vue
... ... @@ -13,7 +13,7 @@
13 13 <script lang="ts">
14 14 import { defineComponent, computed } from 'vue';
15 15 import { Tooltip, Badge } from 'ant-design-vue';
16   - import Icon from '/@/components/Icon';
  16 + import { Icon } from '/@/components/Icon';
17 17  
18 18 import { useI18n } from '/@/hooks/web/useI18n';
19 19 import { useErrorLogStore } from '/@/store/modules/errorLog';
... ...
src/layouts/default/header/components/user-dropdown/DropMenuItem.vue
... ... @@ -11,7 +11,7 @@
11 11  
12 12 import { computed, defineComponent, getCurrentInstance } from 'vue';
13 13  
14   - import Icon from '/@/components/Icon/index';
  14 + import { Icon } from '/@/components/Icon';
15 15 import { propTypes } from '/@/utils/propTypes';
16 16  
17 17 export default defineComponent({
... ...
src/layouts/default/setting/index.vue
... ... @@ -7,7 +7,7 @@
7 7 <script lang="ts">
8 8 import { defineComponent } from 'vue';
9 9 import SettingDrawer from './SettingDrawer';
10   - import Icon from '/@/components/Icon';
  10 + import { Icon } from '/@/components/Icon';
11 11  
12 12 import { useDrawer } from '/@/components/Drawer';
13 13  
... ...
src/views/demo/page/account/center/Application.vue
... ... @@ -30,7 +30,7 @@
30 30 <script lang="ts">
31 31 import { defineComponent } from 'vue';
32 32 import { List, Card, Row, Col } from 'ant-design-vue';
33   - import Icon from '/@/components/Icon/index';
  33 + import { Icon } from '/@/components/Icon';
34 34 import { applicationList } from './data';
35 35  
36 36 export default defineComponent({
... ...
src/views/demo/page/account/center/Article.vue
... ... @@ -42,7 +42,7 @@
42 42 <script lang="ts">
43 43 import { defineComponent } from 'vue';
44 44 import { List, Tag } from 'ant-design-vue';
45   - import Icon from '/@/components/Icon/index';
  45 + import { Icon } from '/@/components/Icon';
46 46 import { actions, articleList } from './data';
47 47  
48 48 export default defineComponent({
... ...
src/views/demo/page/account/center/index.vue
... ... @@ -56,7 +56,7 @@
56 56 import { Tag, Tabs, Row, Col } from 'ant-design-vue';
57 57 import { defineComponent, computed } from 'vue';
58 58 import { CollapseContainer } from '/@/components/Container/index';
59   - import Icon from '/@/components/Icon/index';
  59 + import { Icon } from '/@/components/Icon';
60 60 import Article from './Article.vue';
61 61 import Application from './Application.vue';
62 62 import Project from './Project.vue';
... ...
src/views/demo/page/account/setting/AccountBind.vue
... ... @@ -26,7 +26,7 @@
26 26 import { List } from 'ant-design-vue';
27 27 import { defineComponent } from 'vue';
28 28 import { CollapseContainer } from '/@/components/Container/index';
29   - import Icon from '/@/components/Icon/index';
  29 + import { Icon } from '/@/components/Icon';
30 30  
31 31 import { accountBindList } from './data';
32 32  
... ...
src/views/demo/page/list/basic/index.vue
... ... @@ -53,7 +53,7 @@
53 53 <script lang="ts">
54 54 import { Progress, Row, Col } from 'ant-design-vue';
55 55 import { defineComponent } from 'vue';
56   - import Icon from '/@/components/Icon/index';
  56 + import { Icon } from '/@/components/Icon';
57 57 import { cardList } from './data';
58 58 import { PageWrapper } from '/@/components/Page';
59 59 import { List } from 'ant-design-vue';
... ...
src/views/demo/page/list/card/index.vue
... ... @@ -34,7 +34,7 @@
34 34 </template>
35 35 <script lang="ts">
36 36 import { defineComponent } from 'vue';
37   - import Icon from '/@/components/Icon/index';
  37 + import { Icon } from '/@/components/Icon';
38 38 import { cardList } from './data';
39 39 import { PageWrapper } from '/@/components/Page';
40 40 import { Card, Row, Col, List } from 'ant-design-vue';
... ...
src/views/demo/page/list/search/index.vue
... ... @@ -53,13 +53,12 @@
53 53 </PageWrapper>
54 54 </template>
55 55 <script lang="ts">
56   - import { Tag } from 'ant-design-vue';
  56 + import { Tag, List } from 'ant-design-vue';
57 57 import { defineComponent } from 'vue';
58   - import Icon from '/@/components/Icon/index';
  58 + import { Icon } from '/@/components/Icon';
59 59 import { BasicForm } from '/@/components/Form/index';
60 60 import { actions, searchList, schemas } from './data';
61 61 import { PageWrapper } from '/@/components/Page';
62   - import { List } from 'ant-design-vue';
63 62  
64 63 export default defineComponent({
65 64 components: {
... ...
src/views/form-design/components/VFormDesign/components/FormNodeOperate.vue
... ... @@ -17,7 +17,7 @@
17 17 import { IVFormComponent } from '../../../typings/v-form-component';
18 18 import { remove } from '../../../utils';
19 19 import { useFormDesignState } from '../../../hooks/useFormDesignState';
20   - import Icon from '/@/components/Icon/index';
  20 + import { Icon } from '/@/components/Icon';
21 21  
22 22 export default defineComponent({
23 23 name: 'FormNodeOperate',
... ...
src/views/form-design/components/VFormDesign/components/FormOptions.vue
... ... @@ -38,7 +38,8 @@
38 38 import { remove } from '../../../utils';
39 39 import message from '../../../utils/message';
40 40 import { Input } from 'ant-design-vue';
41   - import Icon from '/@/components/Icon/index';
  41 + import { Icon } from '/@/components/Icon';
  42 +
42 43 export default defineComponent({
43 44 name: 'FormOptions',
44 45 components: { Input, Icon },
... ...
src/views/form-design/components/VFormDesign/components/RuleProps.vue
... ... @@ -38,7 +38,7 @@
38 38 import { useFormDesignState } from '../../../hooks/useFormDesignState';
39 39 import { isArray } from 'lodash-es';
40 40 import { Form, FormItem, AutoComplete, Input } from 'ant-design-vue';
41   - import Icon from '/@/components/Icon';
  41 + import { Icon } from '/@/components/Icon';
42 42  
43 43 export default defineComponent({
44 44 name: 'RuleProps',
... ...
src/views/form-design/components/VFormDesign/modules/Toolbar.vue
... ... @@ -31,7 +31,7 @@
31 31 import { UseRefHistoryReturn } from '@vueuse/core';
32 32 import { IFormConfig } from '../../../typings/v-form-component';
33 33 import { Tooltip, Divider } from 'ant-design-vue';
34   - import Icon from '/@/components/Icon/index';
  34 + import { Icon } from '/@/components/Icon';
35 35  
36 36 interface IToolbarsConfig {
37 37 type: string;
... ...
src/views/form-design/components/VFormItem/index.vue
... ... @@ -47,11 +47,10 @@
47 47 import { handleAsyncOptions } from '../../utils';
48 48 import { omit } from 'lodash-es';
49 49 import { Tooltip, FormItem, Divider, Col } from 'ant-design-vue';
50   -
51 50 // import FormItem from '/@/components/Form/src/components/FormItem.vue';
52   -
53 51 import { Icon } from '/@/components/Icon';
54 52 import { useFormModelState } from '../../hooks/useFormDesignState';
  53 +
55 54 export default defineComponent({
56 55 name: 'VFormItem',
57 56 components: {
... ...