Skip to content

Commit 647cb0f

Browse files
authored
fix(tinyvue): 修复因替换到 @antfu/eslint-config 导致的 bug (#184)
* feat(tinyvue): icon 导入 * fix(tinyvue): 移除 `defineProps、defineExpose` * fix(tinyvue): 调用函数传递了多余参数 * fix(tinyvue): 移除 components/menu/index.vue 中的顶层 await,测试运行正常 * fix(tinyvue): 明确 inject('THEME') 的类型为 TinyThemeTool * style(tinyvue): 代码风格格式化 * style(tinyvue): components代码风格格式化 * style(tinyvue): views/board 代码风格格式化 * style(tinyvue): views/exception 代码风格格式化 * style(tinyvue): views/form 代码风格格式化
1 parent d10d11e commit 647cb0f

File tree

48 files changed

+243
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+243
-375
lines changed
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
<script lang="ts" setup>
2-
import type { PropType } from 'vue'
32
import {
43
Breadcrumb as TinyBreadcrumb,
54
BreadcrumbItem as TinyBreadcrumbItem,
65
} from '@opentiny/vue'
76
8-
defineProps({
9-
items: {
10-
type: Array as PropType<string[]>,
11-
default() {
12-
return []
13-
},
14-
},
15-
})
7+
const { items = [] } = defineProps<{ items?: string[] }>()
168
</script>
179

1810
<template>
@@ -24,7 +16,7 @@ defineProps({
2416
</template>
2517

2618
<style scoped lang="less">
27-
.container-breadcrumb {
19+
.container-breadcrumb {
2820
margin: 16px 0px;
2921
}
3022
</style>

template/tinyvue/src/components/footer/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</template>
1515

1616
<style lang="less" scoped>
17-
.footer {
17+
.footer {
1818
display: flex;
1919
align-items: center;
2020
justify-content: center;

template/tinyvue/src/components/global-setting/index.vue

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Button as TinyButton,
55
Switch as TinySwitch,
66
} from '@opentiny/vue'
7-
import { IconClose } from '@opentiny/vue-icon'
7+
import { iconClose } from '@opentiny/vue-icon'
88
import { useClipboard } from '@vueuse/core'
99
import { computed } from 'vue'
1010
import { useI18n } from 'vue-i18n'
@@ -15,6 +15,8 @@ const appStore = useAppStore()
1515
const visible = computed(() => appStore.Settings)
1616
const { t } = useI18n()
1717
18+
const IconClose = iconClose()
19+
1820
function cancel() {
1921
appStore.updateSettings({ Settings: false })
2022
}
@@ -64,32 +66,23 @@ function changefooter(item: boolean) {
6466
<div>{{ $t('settings.navbar') }}</div>
6567
<div>{{ $t('setting.mode.navbar') }}</div>
6668
</span>
67-
<TinySwitch
68-
v-model="appStore.navbar"
69-
@change="changenavbar"
70-
/>
69+
<TinySwitch v-model="appStore.navbar" @change="changenavbar" />
7170
</div>
7271

7372
<div>
7473
<span>
7574
<div>{{ $t('settings.menu') }}</div>
7675
<div>{{ $t('setting.mode.menu') }}</div>
7776
</span>
78-
<TinySwitch
79-
v-model="appStore.menu"
80-
@change="changemenu"
81-
/>
77+
<TinySwitch v-model="appStore.menu" @change="changemenu" />
8278
</div>
8379

8480
<div>
8581
<span>
8682
<div>{{ $t('settings.footer') }}</div>
8783
<div>{{ $t('setting.mode.footer') }}</div>
8884
</span>
89-
<TinySwitch
90-
v-model="appStore.footer"
91-
@change="changefooter"
92-
/>
85+
<TinySwitch v-model="appStore.footer" @change="changefooter" />
9386
</div>
9487
</div>
9588

@@ -110,7 +103,7 @@ function changefooter(item: boolean) {
110103
</template>
111104

112105
<style scoped lang="less">
113-
.global-set-contain {
106+
.global-set-contain {
114107
position: fixed;
115108
top: 0;
116109
left: 0;

template/tinyvue/src/components/menu/index.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import router from '@/router'
88
import { useAppStore, useTabStore } from '@/store'
99
import { useMenuStore } from '@/store/modules/router'
1010
11-
const menuStore = useMenuStore()
12-
await menuStore.getMenuList()
13-
const rawMenuData = computed(() => useDeepClone(unref(menuStore.menuList)))
1411
type SideMenuData = (ITreeNodeData & { meta: { url: string } })[]
1512
1613
let routerTitle = [] as any
@@ -45,6 +42,10 @@ function filtter(treeNodeDatas: ITreeNodeData[]) {
4542
return menus
4643
}
4744
45+
const menuStore = useMenuStore()
46+
menuStore.getMenuList()
47+
const rawMenuData = computed(() => useDeepClone(unref(menuStore.menuList)))
48+
4849
const MenuData = computed(() => {
4950
if (routerTitle.length) {
5051
routerTitle = []
@@ -68,7 +69,9 @@ function findId(name: string, path: string) {
6869
if (url.join('/') === path) {
6970
return item.id
7071
}
72+
7173
const len = item.children.length ?? 0
74+
7275
for (let i = 0; i < len; i += 1) {
7376
if (item.children?.[i]) {
7477
const id = dfs(
@@ -82,6 +85,7 @@ function findId(name: string, path: string) {
8285
}
8386
return undefined
8487
}
88+
8589
for (let i = 0; i < MenuData.value.length; i += 1) {
8690
const menu = MenuData.value[i]
8791
const data = dfs(menu, [
@@ -94,9 +98,11 @@ function findId(name: string, path: string) {
9498
}
9599
return -1
96100
}
101+
97102
const tree = ref()
98103
const expandeArr = ref<(string | number)[]>([])
99104
const tabStore = useTabStore()
105+
100106
onMounted(() => {
101107
if (window.innerWidth <= 768) {
102108
const collapseBtn = document.querySelector('.tiny-tree-menu__toggle-button')
@@ -127,7 +133,6 @@ onMounted(() => {
127133
:data="MenuData"
128134
:show-filter="false"
129135
node-key="id"
130-
131136
:default-expanded-keys="expandeArr"
132137
only-check-children
133138
check-strictly

template/tinyvue/src/components/navbar/index.vue

Lines changed: 20 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ import {
99
Row as TinyRow,
1010
UserHead as TinyUserHead,
1111
} from '@opentiny/vue'
12-
import {
13-
IconCheckOut,
14-
IconEdit,
15-
IconUser,
16-
} from '@opentiny/vue-icon'
12+
import { iconCheckOut, iconEdit, iconUser } from '@opentiny/vue-icon'
1713
import { computed, reactive, ref } from 'vue'
1814
import { useI18n } from 'vue-i18n'
1915
import { updatePwdUser } from '@/api/user'
@@ -42,13 +38,16 @@ const locales = [...LOCALE_OPTIONS]
4238
const { lg } = useResponsive()
4339
const { modalSize } = useResponsiveSize()
4440
41+
const IconCheckOut = iconCheckOut()
42+
const IconEdit = iconEdit()
43+
const IconUser = iconUser()
44+
4545
const menuOpen = ref(false)
4646
4747
function toggleMenu() {
4848
menuOpen.value = !menuOpen.value
4949
}
5050
51-
// 加载效果
5251
const state = reactive<{
5352
isPwdUpdate: boolean
5453
pwdData: any
@@ -170,12 +169,7 @@ async function handlePwdUpdateSubmit() {
170169
<div class="navbar">
171170
<div class="left-side">
172171
<div style="display: flex; align-items: center">
173-
<img
174-
class="max-lg:w-[38px]"
175-
src="@/assets/images/opentiny-logo.png"
176-
alt="logo"
177-
@click="jumpUrl"
178-
>
172+
<img class="max-lg:w-[38px]" src="@/assets/images/opentiny-logo.png" alt="logo" @click="jumpUrl">
179173
<h5 @click="jumpUrl">
180174
OpenTiny
181175
</h5>
@@ -193,11 +187,7 @@ async function handlePwdUpdateSubmit() {
193187

194188
<ul class="right-side" :class="{ open: menuOpen }">
195189
<li>
196-
<input
197-
id="navbar-search"
198-
class="input-icon"
199-
:placeholder="$t('setting.input.search')"
200-
>
190+
<input id="navbar-search" class="input-icon" :placeholder="$t('setting.input.search')">
201191
</li>
202192
<li v-if="!lg">
203193
<div class="divider" />
@@ -208,9 +198,7 @@ async function handlePwdUpdateSubmit() {
208198
<img src="@/assets/images/lan.png" alt="lan" class="navbar-lan">
209199
<div v-if="lan" class="trigger-lan">
210200
<li
211-
v-for="(item, index) in locales"
212-
:key="index"
213-
:value="item.value"
201+
v-for="(item, index) in locales" :key="index" :value="item.value"
214202
@click="changeLocale(locales[index].value)"
215203
>
216204
{{ item.label }}
@@ -252,24 +240,12 @@ async function handlePwdUpdateSubmit() {
252240
</div>
253241
<div v-if="state.isPwdUpdate">
254242
<TinyModal
255-
v-model="state.isPwdUpdate"
256-
:lock-scroll="true"
257-
show-header
258-
show-footer
259-
mask-closable="true"
260-
height="auto"
261-
:width="modalSize"
262-
:title="$t('userInfo.modal.title.pwdUpdate')"
243+
v-model="state.isPwdUpdate" :lock-scroll="true" show-header show-footer mask-closable="true"
244+
height="auto" :width="modalSize" :title="$t('userInfo.modal.title.pwdUpdate')"
263245
>
264246
<template #default>
265247
<tiny-layout>
266-
<TinyForm
267-
:model="state.pwdData"
268-
:rules="rules"
269-
label-width="120px"
270-
:label-align="true"
271-
label-position="left"
272-
>
248+
<TinyForm :model="state.pwdData" :rules="rules" label-width="120px" :label-align="true" label-position="left">
273249
<TinyRow :flex="true">
274250
<TinyCol :span="10" label-width="100px">
275251
<TinyFormItem :label="$t('userInfo.table.email')">
@@ -280,45 +256,24 @@ async function handlePwdUpdateSubmit() {
280256

281257
<TinyRow :flex="true">
282258
<TinyCol :span="10" label-width="100px">
283-
<TinyFormItem
284-
:label="$t('userInfo.modal.input.oldPassword')"
285-
prop="oldPassword"
286-
>
287-
<TinyInput
288-
v-model="state.pwdData.oldPassword"
289-
type="password"
290-
show-password
291-
/>
259+
<TinyFormItem :label="$t('userInfo.modal.input.oldPassword')" prop="oldPassword">
260+
<TinyInput v-model="state.pwdData.oldPassword" type="password" show-password />
292261
</TinyFormItem>
293262
</TinyCol>
294263
</TinyRow>
295264

296265
<TinyRow :flex="true">
297266
<TinyCol :span="10" label-width="100px">
298-
<TinyFormItem
299-
:label="$t('userInfo.modal.input.newPassword')"
300-
prop="newPassword"
301-
>
302-
<TinyInput
303-
v-model="state.pwdData.newPassword"
304-
type="password"
305-
show-password
306-
/>
267+
<TinyFormItem :label="$t('userInfo.modal.input.newPassword')" prop="newPassword">
268+
<TinyInput v-model="state.pwdData.newPassword" type="password" show-password />
307269
</TinyFormItem>
308270
</TinyCol>
309271
</TinyRow>
310272

311273
<TinyRow :flex="true">
312274
<TinyCol :span="10" label-width="100px">
313-
<TinyFormItem
314-
:label="$t('userInfo.modal.input.confirmNewPassword')"
315-
prop="confirmNewPassword"
316-
>
317-
<TinyInput
318-
v-model="state.pwdData.confirmNewPassword"
319-
type="password"
320-
show-password
321-
/>
275+
<TinyFormItem :label="$t('userInfo.modal.input.confirmNewPassword')" prop="confirmNewPassword">
276+
<TinyInput v-model="state.pwdData.confirmNewPassword" type="password" show-password />
322277
</TinyFormItem>
323278
</TinyCol>
324279
</TinyRow>
@@ -327,22 +282,18 @@ async function handlePwdUpdateSubmit() {
327282
</template>
328283
<template #footer>
329284
<TinyButton type="primary" @click="handlePwdUpdateSubmit">
330-
{{
331-
$t('menu.btn.confirm')
332-
}}
285+
{{ $t('menu.btn.confirm') }}
333286
</TinyButton>
334287
<TinyButton @click="handlePwdUpdateCancel">
335-
{{
336-
$t('menu.btn.cancel')
337-
}}
288+
{{ $t('menu.btn.cancel') }}
338289
</TinyButton>
339290
</template>
340291
</TinyModal>
341292
</div>
342293
</template>
343294

344295
<style scoped lang="less">
345-
.navbar {
296+
.navbar {
346297
display: flex;
347298
justify-content: space-between;
348299
height: 100%;

0 commit comments

Comments
 (0)