style: lint fix

This commit is contained in:
zclzone 2023-05-07 22:05:13 +08:00
parent 6d863e1a63
commit ebffe52c7c
20 changed files with 146 additions and 30 deletions

View File

@ -33,7 +33,10 @@ export default [
defaultClass: 'inline-block',
}),
Components({
resolvers: [NaiveUiResolver(), IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })],
resolvers: [
NaiveUiResolver(),
IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' }),
],
dts: false,
}),
createSvgIconsPlugin({

View File

@ -38,7 +38,8 @@ const posts = [
author: '大脸怪',
category: 'Http',
description: '谈谈前端缓存的理解',
content: '> 背景\n\n公司有个vue-cli3移动端web项目发版更新后发现部分用户手机在钉钉内置浏览器打开出现了缓存',
content:
'> 背景\n\n公司有个vue-cli3移动端web项目发版更新后发现部分用户手机在钉钉内置浏览器打开出现了缓存',
isRecommend: true,
isPublish: true,
createDate: '2021-06-10T18:51:19.000Z',
@ -49,7 +50,8 @@ const posts = [
author: '大脸怪',
category: 'JavaScript',
description: '简单介绍下在 Promise 类中有5 种静态方法及它们的使用场景',
content: '## 1. Promise.all\n\n并行执行多个 promise并等待所有 promise 都准备就绪。再对它们进行处理。',
content:
'## 1. Promise.all\n\n并行执行多个 promise并等待所有 promise 都准备就绪。再对它们进行处理。',
isRecommend: true,
isPublish: true,
createDate: '2021-02-22T22:37:06.000Z',
@ -65,7 +67,9 @@ export default [
const { title, pageNo, pageSize } = data.query
let pageData = []
let total = 60
const filterData = posts.filter((item) => item.title.includes(title) || (!title && title !== 0))
const filterData = posts.filter(
(item) => item.title.includes(title) || (!title && title !== 0)
)
if (filterData.length) {
if (pageSize) {
while (pageData.length < pageSize) {

View File

@ -2,10 +2,20 @@
<footer text-14 f-c-c flex-col color="#6a6a6a">
<p>
Copyright©2022
<a href="https://github.com/zclzone" target="__blank" hover="decoration-underline color-primary"> 大脸怪</a>
<a
href="https://github.com/zclzone"
target="__blank"
hover="decoration-underline color-primary"
>
大脸怪</a
>
</p>
<p>
<a href="http://beian.miit.gov.cn/" target="__blank" hover="decoration-underline color-primary">
<a
href="http://beian.miit.gov.cn/"
target="__blank"
hover="decoration-underline color-primary"
>
赣ICP备2020015008号-1
</a>
</p>

View File

@ -21,7 +21,15 @@
<script setup>
import { defineComponent, h } from 'vue'
import { zhCN, dateZhCN, darkTheme, useLoadingBar, useDialog, useMessage, useNotification } from 'naive-ui'
import {
zhCN,
dateZhCN,
darkTheme,
useLoadingBar,
useDialog,
useMessage,
useNotification,
} from 'naive-ui'
import { useCssVar } from '@vueuse/core'
import { kebabCase } from 'lodash-es'
import { setupMessage, setupDialog } from '@/utils'

View File

@ -1,5 +1,16 @@
<template>
<div min-h-60 p-15 flex items-start justify-between b-1 bc-ccc rounded-8 bg="#fafafc" dark:bg-black>
<div
min-h-60
p-15
flex
items-start
justify-between
b-1
bc-ccc
rounded-8
bg="#fafafc"
dark:bg-black
>
<n-space wrap :size="[35, 15]">
<slot />
</n-space>

View File

@ -1,6 +1,11 @@
<template>
<div flex items-center>
<label v-if="!isNullOrWhitespace(label)" w-80 flex-shrink-0 :style="{ width: labelWidth + 'px' }">
<label
v-if="!isNullOrWhitespace(label)"
w-80
flex-shrink-0
:style="{ width: labelWidth + 'px' }"
>
{{ label }}
</label>
<div :style="{ width: contentWidth + 'px' }" flex-shrink-0>

View File

@ -1,5 +1,12 @@
<template>
<n-modal v-model:show="show" :style="{ width }" preset="card" :title="title" size="huge" :bordered="false">
<n-modal
v-model:show="show"
:style="{ width }"
preset="card"
:title="title"
size="huge"
:bordered="false"
>
<slot />
<template v-if="showFooter" #footer>
<footer flex justify-end>

View File

@ -89,7 +89,11 @@ async function handleQuery() {
if (props.isPagination && props.remote) {
paginationParams = { pageNo: pagination.page, pageSize: pagination.pageSize }
}
const { data } = await props.getData({ ...props.queryItems, ...props.extraParams, ...paginationParams })
const { data } = await props.getData({
...props.queryItems,
...props.extraParams,
...paginationParams,
})
tableData.value = data?.pageData || data
pagination.itemCount = data.total ?? data.length
} catch (error) {

View File

@ -1,7 +1,11 @@
<template>
<router-view v-slot="{ Component, route }">
<KeepAlive :include="keepAliveRouteNames">
<component :is="Component" v-if="appStore.reloadFlag" :key="appStore.aliveKeys[route.name] || route.fullPath" />
<component
:is="Component"
v-if="appStore.reloadFlag"
:key="appStore.aliveKeys[route.name] || route.fullPath"
/>
</KeepAlive>
</router-view>
</template>

View File

@ -53,7 +53,9 @@ function getMenuItem(route, basePath = '') {
order: route.meta?.order || 0,
}
const visibleChildren = route.children ? route.children.filter((item) => item.name && !item.isHidden) : []
const visibleChildren = route.children
? route.children.filter((item) => item.name && !item.isHidden)
: []
if (!visibleChildren.length) return menuItem
@ -67,12 +69,16 @@ function getMenuItem(route, basePath = '') {
path: resolvePath(menuItem.path, singleRoute.path),
icon: getIcon(singleRoute.meta),
}
const visibleItems = singleRoute.children ? singleRoute.children.filter((item) => item.name && !item.isHidden) : []
const visibleItems = singleRoute.children
? singleRoute.children.filter((item) => item.name && !item.isHidden)
: []
if (visibleItems.length === 1) {
menuItem = getMenuItem(visibleItems[0], menuItem.path)
} else if (visibleItems.length > 1) {
menuItem.children = visibleItems.map((item) => getMenuItem(item, menuItem.path)).sort((a, b) => a.order - b.order)
menuItem.children = visibleItems
.map((item) => getMenuItem(item, menuItem.path))
.sort((a, b) => a.order - b.order)
}
} else {
menuItem.children = visibleChildren

View File

@ -67,7 +67,9 @@ const options = computed(() => [
{
label: '关闭右侧',
key: 'close-right',
disabled: tagsStore.tags.length <= 1 || props.currentPath === tagsStore.tags[tagsStore.tags.length - 1].path,
disabled:
tagsStore.tags.length <= 1 ||
props.currentPath === tagsStore.tags[tagsStore.tags.length - 1].path,
icon: renderIcon('mdi:arrow-expand-right', { size: '14px' }),
},
])

View File

@ -26,7 +26,8 @@ export const useTagsStore = defineStore('tag', {
},
addTag(tag = {}) {
this.setActiveTag(tag.path)
if (WITHOUT_TAG_PATHS.includes(tag.path) || this.tags.some((item) => item.path === tag.path)) return
if (WITHOUT_TAG_PATHS.includes(tag.path) || this.tags.some((item) => item.path === tag.path))
return
this.setTags([...this.tags, tag])
},
removeTag(path) {

View File

@ -2,7 +2,8 @@ import { router } from '@/router'
export function toLogin() {
const currentRoute = unref(router.currentRoute)
const needRedirect = !currentRoute.meta.requireAuth && !['/404', '/login'].includes(router.currentRoute.value.path)
const needRedirect =
!currentRoute.meta.requireAuth && !['/404', '/login'].includes(router.currentRoute.value.path)
router.replace({
path: '/login',
query: needRedirect ? { ...currentRoute.query, redirect: currentRoute.path } : {},

View File

@ -15,14 +15,18 @@
<n-card title="带 Icon 的按钮">
<n-space>
<n-button type="info"> <TheIcon icon="material-symbols:add" :size="18" class="mr-5" /> 新增 </n-button>
<n-button type="info">
<TheIcon icon="material-symbols:add" :size="18" class="mr-5" /> 新增
</n-button>
<n-button type="error">
<TheIcon icon="material-symbols:delete-outline" :size="18" class="mr-5" /> 删除
</n-button>
<n-button type="warning">
<TheIcon icon="material-symbols:edit-outline" :size="18" class="mr-5" /> 编辑
</n-button>
<n-button type="primary"> <TheIcon icon="majesticons:eye-line" :size="18" class="mr-5" /> 查看 </n-button>
<n-button type="primary">
<TheIcon icon="majesticons:eye-line" :size="18" class="mr-5" /> 查看
</n-button>
</n-space>
</n-card>
</n-space>

View File

@ -1,7 +1,9 @@
<template>
<CommonPage show-footer>
<p>
文档<a hover-decoration-underline c-blue href="https://uno.antfu.me/" target="_blank">https://uno.antfu.me/</a>
文档<a hover-decoration-underline c-blue href="https://uno.antfu.me/" target="_blank"
>https://uno.antfu.me/</a
>
</p>
<p>
playground

View File

@ -1,7 +1,13 @@
<template>
<AppPage>
<div h-full flex-col border-1 bc-ccc dark:bg-dark>
<WangToolbar border-b bc-ccc :editor="editorRef" :default-config="toolbarConfig" mode="default" />
<WangToolbar
border-b
bc-ccc
:editor="editorRef"
:default-config="toolbarConfig"
mode="default"
/>
<WangEditor
v-model="valueHtml"
style="flex: 1; overflow-y: hidden"

View File

@ -181,7 +181,10 @@ const columns = [
style: 'margin-left: 15px;',
onClick: () => handleDelete(row.id),
},
{ default: () => '删除', icon: renderIcon('material-symbols:delete-outline', { size: 14 }) }
{
default: () => '删除',
icon: renderIcon('material-symbols:delete-outline', { size: 14 }),
}
),
]
},

View File

@ -24,8 +24,15 @@
</div>
<n-space class="mt-16" justify="space-evenly">
<n-button dashed type="primary" @click="copy(item.url)"> url </n-button>
<n-button dashed type="primary" @click="copy(`![${item.fileName}](${item.url})`)">MD</n-button>
<n-button dashed type="primary" @click="copy(`&lt;img src=&quot;${item.url}&quot; /&gt;`)">img</n-button>
<n-button dashed type="primary" @click="copy(`![${item.fileName}](${item.url})`)"
>MD</n-button
>
<n-button
dashed
type="primary"
@click="copy(`&lt;img src=&quot;${item.url}&quot; /&gt;`)"
>img</n-button
>
</n-space>
</n-card>
<div v-for="i in 4" :key="i" class="w-280" />

View File

@ -10,7 +10,9 @@
</div>
<div w-320 flex-col px-20 py-35>
<h5 f-c-c text-24 font-normal color="#6a6a6a"><icon-custom-logo mr-10 text-50 color-primary />{{ title }}</h5>
<h5 f-c-c text-24 font-normal color="#6a6a6a">
<icon-custom-logo mr-10 text-50 color-primary />{{ title }}
</h5>
<div mt-30>
<n-input
v-model:value="loginInfo.name"
@ -33,11 +35,23 @@
</div>
<div mt-20>
<n-checkbox :checked="isRemember" label="记住我" :on-update:checked="(val) => (isRemember = val)" />
<n-checkbox
:checked="isRemember"
label="记住我"
:on-update:checked="(val) => (isRemember = val)"
/>
</div>
<div mt-20>
<n-button w-full h-50 rounded-5 text-16 type="primary" :loading="loading" @click="handleLogin">
<n-button
w-full
h-50
rounded-5
text-16
type="primary"
:loading="loading"
@click="handleLogin"
>
登录
</n-button>
</div>

View File

@ -1,7 +1,18 @@
import { defineConfig, presetAttributify, presetUno } from 'unocss'
export default defineConfig({
exclude: ['node_modules', '.git', '.github', '.husky', '.vscode', 'build', 'dist', 'mock', 'public', './stats.html'],
exclude: [
'node_modules',
'.git',
'.github',
'.husky',
'.vscode',
'build',
'dist',
'mock',
'public',
'./stats.html',
],
presets: [presetUno(), presetAttributify()],
shortcuts: [
['wh-full', 'w-full h-full'],
@ -16,7 +27,10 @@ export default defineConfig({
],
rules: [
[/^bc-(.+)$/, ([, color]) => ({ 'border-color': `#${color}` })],
['card-shadow', { 'box-shadow': '0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017' }],
[
'card-shadow',
{ 'box-shadow': '0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017' },
],
],
theme: {
colors: {