Skip to content

Commit d235ea2

Browse files
authored
refactor: 改为Vue3.5解构语法 (#799)
1 parent 3dfa8f2 commit d235ea2

File tree

8 files changed

+12
-20
lines changed

8 files changed

+12
-20
lines changed

src/components/color/index.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import { DEFAULT_COLOR_OPTIONS } from '@/config/color';
99
const panelColor =
1010
'conic-gradient(from 90deg at 50% 50%, #FF0000 -19.41deg, #FF0000 18.76deg, #FF8A00 59.32deg, #FFE600 99.87deg, #14FF00 141.65deg, #00A3FF 177.72deg, #0500FF 220.23deg, #AD00FF 260.13deg, #FF00C7 300.69deg, #FF0000 340.59deg, #FF0000 378.76deg)';
1111
12-
const props = defineProps({
12+
const { value } = defineProps({
1313
value: {
1414
type: String,
1515
},
1616
});
1717
1818
const style = computed(() => {
19-
const { value } = props;
2019
return {
2120
background: DEFAULT_COLOR_OPTIONS.indexOf(value) > -1 ? value : panelColor,
2221
};

src/components/result/index.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import ResultIeIcon from '@/assets/assets-result-ie.svg?component';
1818
import ResultMaintenanceIcon from '@/assets/assets-result-maintenance.svg?component';
1919
import ResultWifiIcon from '@/assets/assets-result-wifi.svg?component';
2020
21-
const props = defineProps({
21+
const { type } = defineProps({
2222
bgUrl: String,
2323
title: String,
2424
tip: String,
2525
type: String,
2626
});
2727
2828
const dynamicComponent = computed(() => {
29-
switch (props.type) {
29+
switch (type) {
3030
case '403':
3131
return Result403Icon;
3232
case '404':

src/components/thumbnail/index.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<script setup lang="ts">
55
import { computed } from 'vue';
66
7-
const props = defineProps({
7+
const { type } = defineProps({
88
url: String,
99
type: {
1010
type: String,
@@ -13,7 +13,6 @@ const props = defineProps({
1313
});
1414
1515
const className = computed(() => {
16-
const { type } = props;
1716
return [
1817
'thumbnail-container',
1918
{

src/components/trend/index.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<script setup lang="ts">
2424
import { computed } from 'vue';
2525
26-
const props = defineProps({
26+
const { type, isReverseColor } = defineProps({
2727
type: String,
2828
describe: [String, Number],
2929
isReverseColor: {
@@ -33,7 +33,6 @@ const props = defineProps({
3333
});
3434
3535
const containerCls = computed(() => {
36-
const { isReverseColor, type } = props;
3736
return [
3837
'trend-container',
3938
{

src/layouts/components/Header.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ import MenuContent from './MenuContent.vue';
9595
import Notice from './Notice.vue';
9696
import Search from './Search.vue';
9797
98-
const props = defineProps({
98+
const { theme, layout, showLogo, menu, isFixed, isCompact } = defineProps({
9999
theme: {
100100
type: String,
101101
default: 'light',
@@ -141,7 +141,6 @@ const active = computed(() => getActive());
141141
const layoutCls = computed(() => [`${prefix}-header-layout`]);
142142
143143
const menuCls = computed(() => {
144-
const { isFixed, layout, isCompact } = props;
145144
return [
146145
{
147146
[`${prefix}-header-menu`]: !isFixed,
@@ -151,7 +150,7 @@ const menuCls = computed(() => {
151150
},
152151
];
153152
});
154-
const menuTheme = computed(() => props.theme as ModeType);
153+
const menuTheme = computed(() => theme as ModeType);
155154
156155
// 切换语言
157156
const { changeLocale } = useLocale();

src/layouts/components/MenuContent.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import type { MenuRoute } from '@/types/interface';
3434
3535
type ListItemType = MenuRoute & { icon?: string };
3636
37-
const props = defineProps({
37+
const { navData } = defineProps({
3838
navData: {
3939
type: Array as PropType<MenuRoute[]>,
4040
default: () => [],
@@ -45,7 +45,6 @@ const active = computed(() => getActive());
4545
4646
const { locale } = useLocale();
4747
const list = computed(() => {
48-
const { navData } = props;
4948
return getMenuList(navData);
5049
});
5150

src/layouts/components/SideNav.vue

+1-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import MenuContent from './MenuContent.vue';
4242
4343
const MIN_POINT = 992 - 1;
4444
45-
const props = defineProps({
45+
const { menu, showLogo, isFixed, layout, theme, isCompact } = defineProps({
4646
menu: {
4747
type: Array as PropType<MenuRoute[]>,
4848
default: () => [],
@@ -97,11 +97,9 @@ const onExpanded = (value: MenuValue[]) => {
9797
};
9898
9999
const sideMode = computed(() => {
100-
const { theme } = props;
101100
return theme === 'dark';
102101
});
103102
const sideNavCls = computed(() => {
104-
const { isCompact } = props;
105103
return [
106104
`${prefix}-sidebar-layout`,
107105
{
@@ -126,7 +124,6 @@ const versionCls = computed(() => {
126124
];
127125
});
128126
const menuCls = computed(() => {
129-
const { showLogo, isFixed, layout } = props;
130127
return [
131128
`${prefix}-side-nav`,
132129
{

src/pages/list/card/components/DialogForm.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const SELECT_OPTIONS = [
6565
{ label: 'CVM', value: '3' },
6666
];
6767
68-
const props = defineProps({
68+
const { visible, data } = defineProps({
6969
visible: {
7070
type: Boolean,
7171
default: false,
@@ -100,14 +100,14 @@ watch(
100100
);
101101
102102
watch(
103-
() => props.visible,
103+
() => visible,
104104
(val) => {
105105
formVisible.value = val;
106106
},
107107
);
108108
109109
watch(
110-
() => props.data,
110+
() => data,
111111
(val) => {
112112
formData.value = val;
113113
},

0 commit comments

Comments
 (0)