diff --git a/src/App.vue b/src/App.vue index 94635a6..5cc85e5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -81,7 +81,3 @@ document.removeEventListener('mousedown', timekeeping); }); - - diff --git a/src/directives/copy.ts b/src/directives/copy.ts index e888828..61dc3fc 100644 --- a/src/directives/copy.ts +++ b/src/directives/copy.ts @@ -4,7 +4,7 @@ * 接收参数:string类型/Ref类型/Reactive类型 */ import type { Directive, DirectiveBinding } from 'vue'; -import { useMessage } from 'naive-ui'; + interface ElType extends HTMLElement { copyData: string | number; __handleClick__: any; diff --git a/src/directives/debounce.ts b/src/directives/debounce.ts index 931092d..a1889c7 100644 --- a/src/directives/debounce.ts +++ b/src/directives/debounce.ts @@ -3,29 +3,29 @@ * 按钮防抖指令,可自行扩展至input * 接收参数:function类型 */ -import type { Directive, DirectiveBinding } from "vue"; +import type { Directive, DirectiveBinding } from 'vue'; interface ElType extends HTMLElement { - __handleClick__: () => any; + __handleClick__: () => any; } const debounce: Directive = { - mounted(el: ElType, binding: DirectiveBinding) { - if (typeof binding.value !== "function") { - throw "callback must be a function"; - } - let timer: NodeJS.Timeout | null = null; - el.__handleClick__ = function () { - if (timer) { - clearInterval(timer); - } - timer = setTimeout(() => { - binding.value(); - }, 500); - }; - el.addEventListener("click", el.__handleClick__); - }, - beforeUnmount(el: ElType) { - el.removeEventListener("click", el.__handleClick__); - } + mounted(el: ElType, binding: DirectiveBinding) { + if (typeof binding.value !== 'function') { + throw 'callback must be a function'; + } + let timer: NodeJS.Timeout | null = null; + el.__handleClick__ = function () { + if (timer) { + clearInterval(timer); + } + timer = setTimeout(() => { + binding.value(); + }, 500); + }; + el.addEventListener('click', el.__handleClick__); + }, + beforeUnmount(el: ElType) { + el.removeEventListener('click', el.__handleClick__); + }, }; export default debounce; diff --git a/src/directives/draggable.ts b/src/directives/draggable.ts index 65f0cca..1c05c76 100644 --- a/src/directives/draggable.ts +++ b/src/directives/draggable.ts @@ -10,40 +10,40 @@ 使用:在 Dom 上加上 v-draggable 即可
*/ -import type { Directive } from "vue"; +import type { Directive } from 'vue'; interface ElType extends HTMLElement { - parentNode: any; + parentNode: any; } const draggable: Directive = { - mounted: function (el: ElType) { - el.style.cursor = "move"; - el.style.position = "absolute"; - el.onmousedown = function (e) { - let disX = e.pageX - el.offsetLeft; - let disY = e.pageY - el.offsetTop; - document.onmousemove = function (e) { - let x = e.pageX - disX; - let y = e.pageY - disY; - let maxX = el.parentNode.offsetWidth - el.offsetWidth; - let maxY = el.parentNode.offsetHeight - el.offsetHeight; - if (x < 0) { - x = 0; - } else if (x > maxX) { - x = maxX; - } + mounted: function (el: ElType) { + el.style.cursor = 'move'; + el.style.position = 'absolute'; + el.onmousedown = function (e) { + const disX = e.pageX - el.offsetLeft; + const disY = e.pageY - el.offsetTop; + document.onmousemove = function (e) { + let x = e.pageX - disX; + let y = e.pageY - disY; + const maxX = el.parentNode.offsetWidth - el.offsetWidth; + const maxY = el.parentNode.offsetHeight - el.offsetHeight; + if (x < 0) { + x = 0; + } else if (x > maxX) { + x = maxX; + } - if (y < 0) { - y = 0; - } else if (y > maxY) { - y = maxY; - } - el.style.left = x + "px"; - el.style.top = y + "px"; - }; - document.onmouseup = function () { - document.onmousemove = document.onmouseup = null; - }; - }; - } + if (y < 0) { + y = 0; + } else if (y > maxY) { + y = maxY; + } + el.style.left = x + 'px'; + el.style.top = y + 'px'; + }; + document.onmouseup = function () { + document.onmousemove = document.onmouseup = null; + }; + }; + }, }; export default draggable; diff --git a/src/directives/longpress.ts b/src/directives/longpress.ts index e12d0ed..6252996 100644 --- a/src/directives/longpress.ts +++ b/src/directives/longpress.ts @@ -2,48 +2,48 @@ * v-longpress * 长按指令,长按时触发事件 */ -import type { Directive, DirectiveBinding } from "vue"; +import type { Directive, DirectiveBinding } from 'vue'; const directive: Directive = { - mounted(el: HTMLElement, binding: DirectiveBinding) { - if (typeof binding.value !== "function") { - throw "callback must be a function"; - } - // 定义变量 - let pressTimer: any = null; - // 创建计时器( 2秒后执行函数 ) - const start = (e: any) => { - if (e.button) { - if (e.type === "click" && e.button !== 0) { - return; - } - } - if (pressTimer === null) { - pressTimer = setTimeout(() => { - handler(e); - }, 1000); - } - }; - // 取消计时器 - const cancel = () => { - if (pressTimer !== null) { - clearTimeout(pressTimer); - pressTimer = null; - } - }; - // 运行函数 - const handler = (e: MouseEvent | TouchEvent) => { - binding.value(e); - }; - // 添加事件监听器 - el.addEventListener("mousedown", start); - el.addEventListener("touchstart", start); - // 取消计时器 - el.addEventListener("click", cancel); - el.addEventListener("mouseout", cancel); - el.addEventListener("touchend", cancel); - el.addEventListener("touchcancel", cancel); - } + mounted(el: HTMLElement, binding: DirectiveBinding) { + if (typeof binding.value !== 'function') { + throw 'callback must be a function'; + } + // 定义变量 + let pressTimer: any = null; + // 创建计时器( 2秒后执行函数 ) + const start = (e: any) => { + if (e.button) { + if (e.type === 'click' && e.button !== 0) { + return; + } + } + if (pressTimer === null) { + pressTimer = setTimeout(() => { + handler(e); + }, 1000); + } + }; + // 取消计时器 + const cancel = () => { + if (pressTimer !== null) { + clearTimeout(pressTimer); + pressTimer = null; + } + }; + // 运行函数 + const handler = (e: MouseEvent | TouchEvent) => { + binding.value(e); + }; + // 添加事件监听器 + el.addEventListener('mousedown', start); + el.addEventListener('touchstart', start); + // 取消计时器 + el.addEventListener('click', cancel); + el.addEventListener('mouseout', cancel); + el.addEventListener('touchend', cancel); + el.addEventListener('touchcancel', cancel); + }, }; export default directive; diff --git a/src/directives/throttle.ts b/src/directives/throttle.ts index 3050166..d407f8e 100644 --- a/src/directives/throttle.ts +++ b/src/directives/throttle.ts @@ -8,34 +8,34 @@ 使用:给 Dom 加上 v-throttle 及回调函数即可 */ -import type { Directive, DirectiveBinding } from "vue"; +import type { Directive, DirectiveBinding } from 'vue'; interface ElType extends HTMLElement { - __handleClick__: () => any; - disabled: boolean; + __handleClick__: () => any; + disabled: boolean; } const throttle: Directive = { - mounted(el: ElType, binding: DirectiveBinding) { - if (typeof binding.value !== "function") { - throw "callback must be a function"; - } - let timer: NodeJS.Timeout | null = null; - el.__handleClick__ = function () { - if (timer) { - clearTimeout(timer); - } - if (!el.disabled) { - el.disabled = true; - binding.value(); - timer = setTimeout(() => { - el.disabled = false; - }, 1000); - } - }; - el.addEventListener("click", el.__handleClick__); - }, - beforeUnmount(el: ElType) { - el.removeEventListener("click", el.__handleClick__); - } + mounted(el: ElType, binding: DirectiveBinding) { + if (typeof binding.value !== 'function') { + throw 'callback must be a function'; + } + let timer: NodeJS.Timeout | null = null; + el.__handleClick__ = function () { + if (timer) { + clearTimeout(timer); + } + if (!el.disabled) { + el.disabled = true; + binding.value(); + timer = setTimeout(() => { + el.disabled = false; + }, 1000); + } + }; + el.addEventListener('click', el.__handleClick__); + }, + beforeUnmount(el: ElType) { + el.removeEventListener('click', el.__handleClick__); + }, }; export default throttle; diff --git a/src/layout/components/Header/index.vue b/src/layout/components/Header/index.vue index 1eb3588..55d3f36 100644 --- a/src/layout/components/Header/index.vue +++ b/src/layout/components/Header/index.vue @@ -352,7 +352,7 @@ justify-content: space-between; align-items: center; padding: 0; - height: @header-height; + height: 64px; box-shadow: 0 1px 4px rgb(0 21 41 / 8%); transition: all 0.2s ease-in-out; width: 100%; diff --git a/src/main.ts b/src/main.ts index f2fbac9..cabcfcf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -33,6 +33,11 @@ async function bootstrap() { // https://router.vuejs.org/api/interfaces/router.html#isready await router.isReady(); + // https://www.naiveui.com/en-US/os-theme/docs/style-conflict#About-Tailwind's-Preflight-Style-Override + const meta = document.createElement('meta'); + meta.name = 'naive-ui-style'; + document.head.appendChild(meta); + app.mount('#app', true); } diff --git a/src/plugins/naive.ts b/src/plugins/naive.ts index a86832c..a0abd38 100644 --- a/src/plugins/naive.ts +++ b/src/plugins/naive.ts @@ -1,73 +1,141 @@ import type { App } from 'vue'; -import * as NaiveUI from 'naive-ui'; +import { + create, + NMessageProvider, + NDialogProvider, + NConfigProvider, + NInput, + NButton, + NForm, + NFormItem, + NCheckboxGroup, + NCheckbox, + NIcon, + NLayout, + NLayoutHeader, + NLayoutContent, + NLayoutFooter, + NLayoutSider, + NMenu, + NBreadcrumb, + NBreadcrumbItem, + NDropdown, + NSpace, + NTooltip, + NAvatar, + NTabs, + NTabPane, + NCard, + NRow, + NCol, + NDrawer, + NDrawerContent, + NDivider, + NSwitch, + NBadge, + NAlert, + NElement, + NTag, + NNotificationProvider, + NProgress, + NDatePicker, + NGrid, + NGridItem, + NList, + NListItem, + NThing, + NDataTable, + NPopover, + NPagination, + NSelect, + NRadioGroup, + NRadio, + NSteps, + NStep, + NInputGroup, + NResult, + NDescriptions, + NDescriptionsItem, + NTable, + NInputNumber, + NLoadingBarProvider, + NModal, + NUpload, + NTree, + NSpin, + NTimePicker, + NBackTop, + NSkeleton, +} from 'naive-ui'; -const naive = NaiveUI.create({ +// https://www.naiveui.com/en-US/os-theme/docs/import-on-demand +const naive = create({ components: [ - NaiveUI.NMessageProvider, - NaiveUI.NDialogProvider, - NaiveUI.NConfigProvider, - NaiveUI.NInput, - NaiveUI.NButton, - NaiveUI.NForm, - NaiveUI.NFormItem, - NaiveUI.NCheckboxGroup, - NaiveUI.NCheckbox, - NaiveUI.NIcon, - NaiveUI.NLayout, - NaiveUI.NLayoutHeader, - NaiveUI.NLayoutContent, - NaiveUI.NLayoutFooter, - NaiveUI.NLayoutSider, - NaiveUI.NMenu, - NaiveUI.NBreadcrumb, - NaiveUI.NBreadcrumbItem, - NaiveUI.NDropdown, - NaiveUI.NSpace, - NaiveUI.NTooltip, - NaiveUI.NAvatar, - NaiveUI.NTabs, - NaiveUI.NTabPane, - NaiveUI.NCard, - NaiveUI.NRow, - NaiveUI.NCol, - NaiveUI.NDrawer, - NaiveUI.NDrawerContent, - NaiveUI.NDivider, - NaiveUI.NSwitch, - NaiveUI.NBadge, - NaiveUI.NAlert, - NaiveUI.NElement, - NaiveUI.NTag, - NaiveUI.NNotificationProvider, - NaiveUI.NProgress, - NaiveUI.NDatePicker, - NaiveUI.NGrid, - NaiveUI.NGridItem, - NaiveUI.NList, - NaiveUI.NListItem, - NaiveUI.NThing, - NaiveUI.NDataTable, - NaiveUI.NPopover, - NaiveUI.NPagination, - NaiveUI.NSelect, - NaiveUI.NRadioGroup, - NaiveUI.NRadio, - NaiveUI.NSteps, - NaiveUI.NStep, - NaiveUI.NInputGroup, - NaiveUI.NResult, - NaiveUI.NDescriptions, - NaiveUI.NDescriptionsItem, - NaiveUI.NTable, - NaiveUI.NInputNumber, - NaiveUI.NLoadingBarProvider, - NaiveUI.NModal, - NaiveUI.NUpload, - NaiveUI.NTree, - NaiveUI.NSpin, - NaiveUI.NTimePicker, - NaiveUI.NBackTop, - NaiveUI.NSkeleton, + NMessageProvider, + NDialogProvider, + NConfigProvider, + NInput, + NButton, + NForm, + NFormItem, + NCheckboxGroup, + NCheckbox, + NIcon, + NLayout, + NLayoutHeader, + NLayoutContent, + NLayoutFooter, + NLayoutSider, + NMenu, + NBreadcrumb, + NBreadcrumbItem, + NDropdown, + NSpace, + NTooltip, + NAvatar, + NTabs, + NTabPane, + NCard, + NRow, + NCol, + NDrawer, + NDrawerContent, + NDivider, + NSwitch, + NBadge, + NAlert, + NElement, + NTag, + NNotificationProvider, + NProgress, + NDatePicker, + NGrid, + NGridItem, + NList, + NListItem, + NThing, + NDataTable, + NPopover, + NPagination, + NSelect, + NRadioGroup, + NRadio, + NSteps, + NStep, + NInputGroup, + NResult, + NDescriptions, + NDescriptionsItem, + NTable, + NInputNumber, + NLoadingBarProvider, + NModal, + NUpload, + NTree, + NSpin, + NTimePicker, + NBackTop, + NSkeleton, ], }); diff --git a/src/styles/common.less b/src/styles/common.less deleted file mode 100644 index 2fe45ad..0000000 --- a/src/styles/common.less +++ /dev/null @@ -1,135 +0,0 @@ -#app, -body, -html { - height: 100%; -} - -body { - font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, - '\5FAE\8F6F\96C5\9ED1', Arial, sans-serif; - line-height: 1.5; - color: #515a6e; - font-size: 14px; - background-color: #f7f7f7; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -//重置样式 -.anticon { - svg { - vertical-align: initial; - } -} - -a { - color: #2d8cf0; - background: transparent; - text-decoration: none; - outline: none; - cursor: pointer; - transition: color 0.2s ease; -} - -a:active, -a:hover { - outline-width: 0; -} - -a:hover { - color: #57a3f3; -} - -a:active { - color: #2b85e4; -} - -a:active, -a:hover { - outline: 0; - text-decoration: none; -} - -/* 滚动条凹槽的颜色,还可以设置边框属性 */ -*::-webkit-scrollbar-track-piece { - background-color: #f8f8f8; - -webkit-border-radius: 2em; - -moz-border-radius: 2em; - border-radius: 2em; -} - -/* 滚动条的宽度 */ -*::-webkit-scrollbar { - width: 9px; - height: 9px; -} - -/* 滚动条的设置 */ -*::-webkit-scrollbar-thumb { - background-color: #ddd; - background-clip: padding-box; - -webkit-border-radius: 2em; - -moz-border-radius: 2em; - border-radius: 2em; -} - -/* 滚动条鼠标移上去 */ -*::-webkit-scrollbar-thumb:hover { - background-color: #bbb; -} - -/* router view transition */ -.zoom-fade-enter-active, -.zoom-fade-leave-active { - transition: transform 0.35s, opacity 0.28s ease-in-out; -} - -.zoom-fade-enter-from { - opacity: 0; - transform: scale(0.97); -} - -.zoom-fade-leave-to { - opacity: 0; - transform: scale(1.03); -} - -//antd 卡片样式定制 -body .n-card { - transition: all 0.2s ease-in-out; -} - -body .n-icon { - vertical-align: middle; -} - -body .proCard { - border-radius: 4px; - - .n-card__content { - padding: 16px; - - &:first-child { - padding-top: 16px; - } - } -} - -body .n-modal { - border-radius: 6px; -} - -//body .proCardTabs{ -// .n-card__content{ padding-top: 3px} -// .n-card__content:first-child{ padding-top: 3px} -//} - -.n-layout-page-header { - margin: 0 -10px; -} - -img, video{ - display: block; - max-width: 100%; - height: auto; -} \ No newline at end of file diff --git a/src/styles/index.less b/src/styles/index.less deleted file mode 100644 index 17fde33..0000000 --- a/src/styles/index.less +++ /dev/null @@ -1,3 +0,0 @@ -@import 'transition/index.less'; -@import './var.less'; -@import './common.less'; diff --git a/src/styles/transition/base.less b/src/styles/transition/base.less deleted file mode 100644 index 7944c8b..0000000 --- a/src/styles/transition/base.less +++ /dev/null @@ -1,18 +0,0 @@ -.transition-default() { - &-enter-active, - &-leave-active { - transition: 0.3s cubic-bezier(0.25, 0.8, 0.5, 1) !important; - } - - &-move { - transition: transform 0.4s; - } -} - -.expand-transition { - .transition-default(); -} - -.expand-x-transition { - .transition-default(); -} diff --git a/src/styles/transition/fade.less b/src/styles/transition/fade.less deleted file mode 100644 index 1f8e63e..0000000 --- a/src/styles/transition/fade.less +++ /dev/null @@ -1,81 +0,0 @@ -.fade-enter-active, -.fade-leave-active { - transition: opacity 0.2s ease-in-out; -} - -.fade-enter-from, -.fade-leave-to { - opacity: 0; -} - -/* fade-slide */ -.fade-slide-leave-active, -.fade-slide-enter-active { - transition: all 0.3s; -} - -.fade-slide-enter-from { - opacity: 0; - transform: translateX(-30px); -} - -.fade-slide-leave-to { - opacity: 0; - transform: translateX(30px); -} - -// /////////////////////////////////////////////// -// Fade Bottom -// /////////////////////////////////////////////// - -// Speed: 1x -.fade-bottom-enter-active, -.fade-bottom-leave-active { - transition: opacity 0.25s, transform 0.3s; -} - -.fade-bottom-enter-from { - opacity: 0; - transform: translateY(-10%); -} - -.fade-bottom-leave-to { - opacity: 0; - transform: translateY(10%); -} - -// fade-scale -.fade-scale-leave-active, -.fade-scale-enter-active { - transition: all 0.28s; -} - -.fade-scale-enter-from { - opacity: 0; - transform: scale(1.2); -} - -.fade-scale-leave-to { - opacity: 0; - transform: scale(0.8); -} - -// /////////////////////////////////////////////// -// Fade Top -// /////////////////////////////////////////////// - -// Speed: 1x -.fade-top-enter-active, -.fade-top-leave-active { - transition: opacity 0.2s, transform 0.25s; -} - -.fade-top-enter-from { - opacity: 0; - transform: translateY(8%); -} - -.fade-top-leave-to { - opacity: 0; - transform: translateY(-8%); -} diff --git a/src/styles/transition/index.less b/src/styles/transition/index.less deleted file mode 100644 index e372b25..0000000 --- a/src/styles/transition/index.less +++ /dev/null @@ -1,10 +0,0 @@ -@import './base.less'; -@import './fade.less'; -@import './scale.less'; -@import './slide.less'; -@import './scroll.less'; -@import './zoom.less'; - -.collapse-transition { - transition: 0.2s height ease-in-out, 0.2s padding-top ease-in-out, 0.2s padding-bottom ease-in-out; -} diff --git a/src/styles/transition/scale.less b/src/styles/transition/scale.less deleted file mode 100644 index c965493..0000000 --- a/src/styles/transition/scale.less +++ /dev/null @@ -1,21 +0,0 @@ -.scale-transition { - .transition-default(); - - &-enter-from, - &-leave, - &-leave-to { - opacity: 0; - transform: scale(0); - } -} - -.scale-rotate-transition { - .transition-default(); - - &-enter-from, - &-leave, - &-leave-to { - opacity: 0; - transform: scale(0) rotate(-45deg); - } -} diff --git a/src/styles/transition/scroll.less b/src/styles/transition/scroll.less deleted file mode 100644 index a5f45e4..0000000 --- a/src/styles/transition/scroll.less +++ /dev/null @@ -1,67 +0,0 @@ -.scroll-y-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - } - - &-enter-from { - transform: translateY(-15px); - } - - &-leave-to { - transform: translateY(15px); - } -} - -.scroll-y-reverse-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - } - - &-enter-from { - transform: translateY(15px); - } - - &-leave-to { - transform: translateY(-15px); - } -} - -.scroll-x-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - } - - &-enter-from { - transform: translateX(-15px); - } - - &-leave-to { - transform: translateX(15px); - } -} - -.scroll-x-reverse-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - } - - &-enter-from { - transform: translateX(15px); - } - - &-leave-to { - transform: translateX(-15px); - } -} diff --git a/src/styles/transition/slide.less b/src/styles/transition/slide.less deleted file mode 100644 index 79b00df..0000000 --- a/src/styles/transition/slide.less +++ /dev/null @@ -1,39 +0,0 @@ -.slide-y-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - transform: translateY(-15px); - } -} - -.slide-y-reverse-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - transform: translateY(15px); - } -} - -.slide-x-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - transform: translateX(-15px); - } -} - -.slide-x-reverse-transition { - .transition-default(); - - &-enter-from, - &-leave-to { - opacity: 0; - transform: translateX(15px); - } -} diff --git a/src/styles/transition/zoom.less b/src/styles/transition/zoom.less deleted file mode 100644 index 2ea378c..0000000 --- a/src/styles/transition/zoom.less +++ /dev/null @@ -1,27 +0,0 @@ -// zoom-out -.zoom-out-enter-active, -.zoom-out-leave-active { - transition: opacity 0.1 ease-in-out, transform 0.15s ease-out; -} - -.zoom-out-enter-from, -.zoom-out-leave-to { - opacity: 0; - transform: scale(0); -} - -// zoom-fade -.zoom-fade-enter-active, -.zoom-fade-leave-active { - transition: transform 0.2s, opacity 0.3s ease-out; -} - -.zoom-fade-enter-from { - opacity: 0; - transform: scale(0.92); -} - -.zoom-fade-leave-to { - opacity: 0; - transform: scale(1.06); -} diff --git a/src/styles/var.less b/src/styles/var.less deleted file mode 100644 index e0fb0cb..0000000 --- a/src/styles/var.less +++ /dev/null @@ -1,4 +0,0 @@ -@primaryColor: #2d8cf0; -@primaryColorHover: #57a3f3; -@header-height: 64px; -@footer-height: 70px; diff --git a/tailwind.config.js b/tailwind.config.js index eaed4a3..1611dfc 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,9 +1,5 @@ module.exports = { - plugins: [createEnterPlugin()], content: ['./index.html', './src/**/*.{vue,ts,tsx}'], - corePlugins: { - preflight: false, - }, theme: { extend: { zIndex: { @@ -25,52 +21,3 @@ module.exports = { }, }, }; -/** - * Used for animation when the element is displayed - * @param maxOutput The larger the maxOutput output, the larger the generated css volume - */ -function createEnterPlugin(maxOutput = 6) { - const createCss = (index, d = 'x') => { - const upd = d.toUpperCase(); - return { - [`*> .enter-${d}:nth-child(${index})`]: { - transform: `translate${upd}(50px)`, - }, - [`*> .-enter-${d}:nth-child(${index})`]: { - transform: `translate${upd}(-50px)`, - }, - [`* > .enter-${d}:nth-child(${index}),* > .-enter-${d}:nth-child(${index})`]: { - 'z-index': `${10 - index}`, - opacity: '0', - animation: `enter-${d}-animation 0.4s ease-in-out 0.3s`, - 'animation-fill-mode': 'forwards', - 'animation-delay': `${(index * 1) / 10}s`, - }, - }; - }; - const handler = ({ addBase }) => { - const addRawCss = {}; - for (let index = 1; index < maxOutput; index++) { - Object.assign(addRawCss, { - ...createCss(index, 'x'), - ...createCss(index, 'y'), - }); - } - addBase({ - ...addRawCss, - [`@keyframes enter-x-animation`]: { - to: { - opacity: '1', - transform: 'translateX(0)', - }, - }, - [`@keyframes enter-y-animation`]: { - to: { - opacity: '1', - transform: 'translateY(0)', - }, - }, - }); - }; - return { handler }; -} diff --git a/vite.config.ts b/vite.config.ts index 977aee0..87a49bd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -46,15 +46,15 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { define: { __APP_INFO__: JSON.stringify(__APP_INFO__), }, - css: { - preprocessorOptions: { - less: { - modifyVars: {}, - javascriptEnabled: true, - additionalData: `@import "src/styles/var.less";`, - }, - }, - }, + // css: { + // preprocessorOptions: { + // less: { + // modifyVars: {}, + // javascriptEnabled: true, + // additionalData: `@import "src/styles/var.less";`, + // }, + // }, + // }, server: { host: true, port: VITE_PORT,