refactor: 重构axios相关代码

This commit is contained in:
fonghehe 2023-07-05 17:49:30 +08:00
parent ab5a4502e6
commit 5df1c50397
25 changed files with 326 additions and 215 deletions

View File

@ -1,3 +1,2 @@
/dist/*
/public/*
public/*
dist
public

View File

@ -61,11 +61,13 @@
"prettier": "^3.0.0",
"rollup-plugin-visualizer": "^5.9.1",
"stylelint": "^15.10.1",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-property-sort-order-smacss": "^9.1.0",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-config-standard-scss": "^10.0.0",
"stylelint-order": "^6.0.3",
"stylelint-prettier": "^3.0.0",
"terser": "^5.18.1",
"typescript": "^5.1.6",
"unplugin-auto-import": "^0.16.6",

111
pnpm-lock.yaml generated
View File

@ -146,9 +146,9 @@ devDependencies:
stylelint:
specifier: ^15.10.1
version: 15.10.1
stylelint-config-prettier:
specifier: ^9.0.5
version: 9.0.5(stylelint@15.10.1)
stylelint-config-property-sort-order-smacss:
specifier: ^9.1.0
version: 9.1.0(stylelint@15.10.1)
stylelint-config-recommended:
specifier: ^13.0.0
version: 13.0.0(stylelint@15.10.1)
@ -158,9 +158,15 @@ devDependencies:
stylelint-config-standard:
specifier: ^34.0.0
version: 34.0.0(stylelint@15.10.1)
stylelint-config-standard-scss:
specifier: ^10.0.0
version: 10.0.0(postcss@8.4.24)(stylelint@15.10.1)
stylelint-order:
specifier: ^6.0.3
version: 6.0.3(stylelint@15.10.1)
stylelint-prettier:
specifier: ^3.0.0
version: 3.0.0(prettier@3.0.0)(stylelint@15.10.1)
terser:
specifier: ^5.18.1
version: 5.18.1
@ -3871,6 +3877,10 @@ packages:
engines: {node: '>=12.22'}
dev: true
/css-property-sort-order-smacss@2.2.0:
resolution: {integrity: sha512-nXutswsivIEBOrPo/OZw2KQjFPLvtg68aovJf6Kqrm3L6FmTvvFPaeDrk83hh0+pRJGuP3PeKJwMS0E6DFipdQ==}
dev: true
/css-select@4.3.0:
resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==}
dependencies:
@ -7596,6 +7606,10 @@ packages:
postcss: 8.4.24
dev: true
/postcss-media-query-parser@0.2.3:
resolution: {integrity: sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==}
dev: true
/postcss-prefix-selector@1.16.0(postcss@5.2.18):
resolution: {integrity: sha512-rdVMIi7Q4B0XbXqNUEI+Z4E+pueiu/CS5E6vRCQommzdQ/sgsS4dK42U7GX8oJR+TJOtT+Qv3GkNo6iijUMp3Q==}
peerDependencies:
@ -7617,6 +7631,15 @@ packages:
postcss: 8.4.24
dev: true
/postcss-scss@4.0.6(postcss@8.4.24):
resolution: {integrity: sha512-rLDPhJY4z/i4nVFZ27j9GqLxj1pwxE80eAzUNRMXtcpipFYIeowerzBgG3yJhMtObGEXidtIgbUpQ3eLDsf5OQ==}
engines: {node: '>=12.0'}
peerDependencies:
postcss: ^8.4.19
dependencies:
postcss: 8.4.24
dev: true
/postcss-selector-parser@6.0.13:
resolution: {integrity: sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==}
engines: {node: '>=4'}
@ -8653,14 +8676,30 @@ packages:
stylelint: 15.10.1
dev: true
/stylelint-config-prettier@9.0.5(stylelint@15.10.1):
resolution: {integrity: sha512-U44lELgLZhbAD/xy/vncZ2Pq8sh2TnpiPvo38Ifg9+zeioR+LAkHu0i6YORIOxFafZoVg0xqQwex6e6F25S5XA==}
engines: {node: '>= 12'}
hasBin: true
/stylelint-config-property-sort-order-smacss@9.1.0(stylelint@15.10.1):
resolution: {integrity: sha512-TijYeDoDgHAFjpn9NnziQrmUCGrm2AM4e1HzsdI2mCWBRkQRuewc343YqDwdFgQ5eHoMZ3JRL02i72W3vktuDA==}
peerDependencies:
stylelint: '>= 11.x < 15'
stylelint: ^14.0.0 || ^15.0.0
dependencies:
css-property-sort-order-smacss: 2.2.0
stylelint: 15.10.1
stylelint-order: 6.0.3(stylelint@15.10.1)
dev: true
/stylelint-config-recommended-scss@12.0.0(postcss@8.4.24)(stylelint@15.10.1):
resolution: {integrity: sha512-5Bb2mlGy6WLa30oNeKpZvavv2lowJUsUJO25+OA68GFTemlwd1zbFsL7q0bReKipOSU3sG47hKneZ6Nd+ctrFA==}
peerDependencies:
postcss: ^8.3.3
stylelint: ^15.5.0
peerDependenciesMeta:
postcss:
optional: true
dependencies:
postcss: 8.4.24
postcss-scss: 4.0.6(postcss@8.4.24)
stylelint: 15.10.1
stylelint-config-recommended: 12.0.0(stylelint@15.10.1)
stylelint-scss: 5.0.1(stylelint@15.10.1)
dev: true
/stylelint-config-recommended-vue@1.4.0(postcss-html@1.5.0)(stylelint@15.10.1):
@ -8677,6 +8716,14 @@ packages:
stylelint-config-recommended: 13.0.0(stylelint@15.10.1)
dev: true
/stylelint-config-recommended@12.0.0(stylelint@15.10.1):
resolution: {integrity: sha512-x6x8QNARrGO2sG6iURkzqL+Dp+4bJorPMMRNPScdvaUK8PsynriOcMW7AFDKqkWAS5wbue/u8fUT/4ynzcmqdQ==}
peerDependencies:
stylelint: ^15.5.0
dependencies:
stylelint: 15.10.1
dev: true
/stylelint-config-recommended@13.0.0(stylelint@15.10.1):
resolution: {integrity: sha512-EH+yRj6h3GAe/fRiyaoO2F9l9Tgg50AOFhaszyfov9v6ayXJ1IkSHwTxd7lB48FmOeSGDPLjatjO11fJpmarkQ==}
engines: {node: ^14.13.1 || >=16.0.0}
@ -8686,6 +8733,30 @@ packages:
stylelint: 15.10.1
dev: true
/stylelint-config-standard-scss@10.0.0(postcss@8.4.24)(stylelint@15.10.1):
resolution: {integrity: sha512-bChBEo1p3xUVWh/wenJI+josoMk21f2yuLDGzGjmKYcALfl2u3DFltY+n4UHswYiXghqXaA8mRh+bFy/q1hQlg==}
peerDependencies:
postcss: ^8.3.3
stylelint: ^15.5.0
peerDependenciesMeta:
postcss:
optional: true
dependencies:
postcss: 8.4.24
stylelint: 15.10.1
stylelint-config-recommended-scss: 12.0.0(postcss@8.4.24)(stylelint@15.10.1)
stylelint-config-standard: 33.0.0(stylelint@15.10.1)
dev: true
/stylelint-config-standard@33.0.0(stylelint@15.10.1):
resolution: {integrity: sha512-eyxnLWoXImUn77+ODIuW9qXBDNM+ALN68L3wT1lN2oNspZ7D9NVGlNHb2QCUn4xDug6VZLsh0tF8NyoYzkgTzg==}
peerDependencies:
stylelint: ^15.5.0
dependencies:
stylelint: 15.10.1
stylelint-config-recommended: 12.0.0(stylelint@15.10.1)
dev: true
/stylelint-config-standard@34.0.0(stylelint@15.10.1):
resolution: {integrity: sha512-u0VSZnVyW9VSryBG2LSO+OQTjN7zF9XJaAJRX/4EwkmU0R2jYwmBSN10acqZisDitS0CLiEiGjX7+Hrq8TAhfQ==}
engines: {node: ^14.13.1 || >=16.0.0}
@ -8706,6 +8777,30 @@ packages:
stylelint: 15.10.1
dev: true
/stylelint-prettier@3.0.0(prettier@3.0.0)(stylelint@15.10.1):
resolution: {integrity: sha512-kIks1xw6np0zElokMT2kP6ar3S4MBoj6vUtPJuND1pFELMpZxVS/0uHPR4HDAVn0WAD3I5oF0IA3qBFxBpMkLg==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
prettier: '>=2.0.0'
stylelint: '>=14.0.0'
dependencies:
prettier: 3.0.0
prettier-linter-helpers: 1.0.0
stylelint: 15.10.1
dev: true
/stylelint-scss@5.0.1(stylelint@15.10.1):
resolution: {integrity: sha512-n87iCRZrr2J7//I/QFsDXxFLnHKw633U4qvWZ+mOW6KDAp/HLj06H+6+f9zOuTYy+MdGdTuCSDROCpQIhw5fvQ==}
peerDependencies:
stylelint: ^14.5.1 || ^15.0.0
dependencies:
postcss-media-query-parser: 0.2.3
postcss-resolve-nested-selector: 0.1.1
postcss-selector-parser: 6.0.13
postcss-value-parser: 4.2.0
stylelint: 15.10.1
dev: true
/stylelint@15.10.1:
resolution: {integrity: sha512-CYkzYrCFfA/gnOR+u9kJ1PpzwG10WLVnoxHDuBA/JiwGqdM9+yx9+ou6SE/y9YHtfv1mcLo06fdadHTOx4gBZQ==}
engines: {node: ^14.13.1 || >=16.0.0}

View File

@ -7,4 +7,12 @@ module.exports = {
proseWrap: 'never',
htmlWhitespaceSensitivity: 'strict',
endOfLine: 'auto',
overrides: [
{
files: '.*rc',
options: {
parser: 'json',
},
},
],
};

View File

@ -1,12 +1,11 @@
import useAxiosApi from '/@/utils/useAxiosApi';
import { http } from '@/utils/request';
/**
*
* @returns UseAxiosReturn
*/
export function loginPassword() {
return useAxiosApi(`/api/login`, {
method: 'POST',
return http.post(`/api/login`, {
data: { name: '123' },
});
}

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -3,7 +3,8 @@
* @Date: 2023-05-10 11:46:19
* @Description: file content
*/
import { i18n } from '/@/i18n';
import { i18n } from '@/i18n';
import { Component } from 'vue';
import BaseModal from '../BasicModal.vue';
import { createApp, ref, defineComponent } from 'vue';

View File

@ -1,41 +1,52 @@
.modal-content {
@include center();
position: relative;
width: 650px;
background-repeat: no-repeat;
background-size: cover;
position: relative;
@include center();
&.normal {
height: 604px;
background-image: url(@/assets/BaseModal/modal-bg-normal.png);
background-image: url('@/assets/baseModal/modal-bg-normal.png');
}
&.large {
height: 754px;
background-image: url(@/assets/BaseModal/modal-bg-large.png);
background-image: url('@/assets/baseModal/modal-bg-large.png');
}
.content {
width: 100%;
@include center();
width: 100%;
}
.btn {
display: flex;
width: 100%;
justify-content: space-around;
position: absolute;
bottom: 10px;
justify-content: space-around;
width: 100%;
&-cancel {
@extend .btn-common;
background-color: coral;
}
&-confirm {
@extend .btn-common;
background-color: skyblue;
}
}
}
.btn-common {
@include center();
width: 250px;
height: 100px;
border-radius: 10px;
@include center();
}

View File

@ -1,8 +1,8 @@
import { createApp } from 'vue';
import App from './App.vue';
import { i18n } from '/@/i18n';
import router from '/@/router';
import store from '/@/store';
import { i18n } from '@/i18n';
import router from '@/router';
import store from '@/store';
import './assets/font/iconfont.css';
import './assets/app.css';

View File

@ -2,11 +2,11 @@ export const routes = [
{
path: '/',
redirect: '/home',
component: () => import('/@/layout/basic/index.vue'),
component: () => import('@/layout/basic/index.vue'),
children: [
{
path: 'home',
component: () => import('/@/views/home/index.vue'),
component: () => import('@/views/home/index.vue'),
meta: {
title: 'tabbar.home',
keepAlive: true,
@ -14,7 +14,7 @@ export const routes = [
},
{
path: 'list',
component: () => import('/@/views/list/index.vue'),
component: () => import('@/views/list/index.vue'),
meta: {
title: 'tabbar.list',
keepAlive: true,
@ -22,7 +22,7 @@ export const routes = [
},
{
path: 'member',
component: () => import('/@/views/member/index.vue'),
component: () => import('@/views/member/index.vue'),
meta: {
title: 'tabbar.member',
keepAlive: true,
@ -30,7 +30,7 @@ export const routes = [
},
{
path: 'demo',
component: () => import('/@/views/demo/index.vue'),
component: () => import('@/views/demo/index.vue'),
meta: {
title: 'tabbar.demo',
keepAlive: true,
@ -39,7 +39,7 @@ export const routes = [
{
name: 'listDetails',
path: '/details',
component: () => import('/@/views/list/details/index.vue'),
component: () => import('@/views/list/details/index.vue'),
meta: {
title: 'list.details',
border: false,
@ -50,7 +50,7 @@ export const routes = [
{
name: 'login',
path: '/login',
component: () => import('/@/views/login/index.vue'),
component: () => import('@/views/login/index.vue'),
meta: {
title: '',
keepAlive: true,

View File

@ -1,4 +1,4 @@
import { loginPassword } from '/@/api';
import { loginPassword } from '@/api';
import { useCookies } from '@vueuse/integrations/useCookies';
import { defineStore } from 'pinia';
@ -27,8 +27,7 @@ export const useUserStore = defineStore({
},
login() {
return new Promise((resolve) => {
const { execute } = loginPassword();
execute().then((res) => {
loginPassword().then((res) => {
this.setInfo(res);
resolve(res);
});
@ -41,30 +40,3 @@ export const useUserStore = defineStore({
paths: ['token'],
},
});
// export const useUserStore = defineStore('app-user', () => {
// const Token = ref(token);
// const info = ref<Record<any, any>>({});
// const setInfo = (info: any) => {
// info.value = info ? info : '';
// };
// const getUserInfo = () => {
// return info || {};
// };
// const login = () => {
// return new Promise((resolve) => {
// const { data } = loginPassword();
// watch(data, () => {
// setInfo(data.value);
// // useCookies().set(VITE_TOKEN_KEY as string, data.value.token);
// resolve(data.value);
// });
// });
// };
// return {
// Token,
// info,
// setInfo,
// login,
// getUserInfo,
// };
// });

View File

@ -1,16 +0,0 @@
export function typeCheck(param: any) {
return Object.prototype.toString.call(param);
}
/**
* stage
*/
export function mutateState(state: Record<string, any>, payload: Record<string, any>) {
if (typeCheck(state) === '[object Object]' && typeCheck(payload) === '[object Object]') {
for (const key in payload) {
state[key] = payload[key];
}
} else {
console.error('expected plain Object');
}
}

View File

@ -0,0 +1,53 @@
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
import { showToast } from 'vant';
const service: AxiosInstance = axios.create({
withCredentials: false,
timeout: 5000,
});
service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
return config;
},
(error: AxiosError) => {
return Promise.reject(error);
},
);
service.interceptors.response.use(
(response: AxiosResponse) => {
const res = response.data;
if (res.code !== 200) {
showToast(res.msg);
return Promise.reject(res.msg || 'Error');
} else {
return res;
}
},
(error: AxiosError) => {
console.log('err' + error);
showToast(error.message);
return Promise.reject(error.message);
},
);
export const http = {
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T> {
return service.get(url, config);
},
post<T = any>(url: string, data?: object, config?: AxiosRequestConfig): Promise<T> {
return service.post(url, data, config);
},
put<T = any>(url: string, data?: object, config?: AxiosRequestConfig): Promise<T> {
return service.put(url, data, config);
},
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T> {
return service.delete(url, config);
},
};
export default service;

View File

@ -0,0 +1,11 @@
import { useAxios } from '@vueuse/integrations/useAxios';
import 'vant/es/toast/style';
/**
* reactive useFetchApi
*/
export default function useAxiosApi(url: string, config: any) {
return useAxios(url, config);
}

View File

@ -1,73 +0,0 @@
import { useAxios } from '@vueuse/integrations/useAxios';
import axios from 'axios';
import { showToast } from 'vant';
import 'vant/es/toast/style';
// create an axios instance
const instance = axios.create({
withCredentials: false,
timeout: 5000,
});
// request interceptor
instance.interceptors.request.use(
(config) => {
// do something before request is sent
// const token = store.state.user.token;
// if (token) {
// // let each request carry token
// config.headers = {
// ...config.headers,
// Authorization: `Bearer ${token}`
// };
// }
return config;
},
(error) => {
// do something with request error
console.log(error); // for debug
return Promise.reject(error);
},
);
// response interceptor
instance.interceptors.response.use(
/**
* If you want to get http information such as headers or status
* Please return response => response
*/
/**
* Determine the request status by custom code
* Here is just an example
* You can also judge the status by HTTP Status Code
*/
(response) => {
const res = response.data;
// if the custom code is not 200, it is judged as an error.
if (res.code !== 200) {
showToast(res.msg);
// 412: Token expired;
if (res.code === 412) {
// store.dispatch('user/userLogout');
}
return Promise.reject(res.msg || 'Error');
} else {
return res;
}
},
(error) => {
console.log('err' + error);
showToast(error.message);
return Promise.reject(error.message);
},
);
/**
* reactive useFetchApi
*/
export default function useAxiosApi(url: string, config: any) {
return useAxios(url, config);
}

View File

@ -51,7 +51,7 @@
</template>
<script setup name="DemoPage" lang="tsx">
import { openFactoryModal } from '/@/components/Modal/index';
import { openFactoryModal } from '@/components/Modal/index';
import 'quarkd/lib/button';
const openLargeModal = () => {
@ -80,10 +80,10 @@
section {
.title {
font-size: 40px;
margin-bottom: 40px;
font-weight: 500;
display: inline-block;
margin-bottom: 40px;
font-size: 40px;
font-weight: 500;
}
&:nth-child(n) {

View File

@ -33,8 +33,8 @@
<script lang="ts" setup name="HomePage">
import { computed } from 'vue';
import { useUserStore } from '/@/store/modules/user';
import { setLang } from '/@/i18n';
import { useUserStore } from '@/store/modules/user';
import { setLang } from '@/i18n';
import { useI18n } from 'vue-i18n';
import { Github, Check } from '@nutui/icons-vue';
@ -54,10 +54,11 @@
<style lang="scss">
.header {
display: flex;
justify-content: center;
align-items: center;
justify-content: center;
padding: 0 20px;
font-size: 40px;
img {
width: 90px;
height: 90px;
@ -65,10 +66,10 @@
}
.intro-header {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
font-size: 16px;
}
@ -83,6 +84,7 @@
.btn-wrap {
margin: 20px;
}
.btn-confirm {
@include main-lang-bg(302px, 82px, '/@/assets/button', 'confirm.png');
}

View File

@ -14,9 +14,9 @@
</template>
<script lang="ts" setup name="LoginPage">
import router from '/@/router';
import router from '@/router';
import { reactive, ref } from 'vue';
import { useUserStore } from '/@/store/modules/user';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const formData = reactive({
@ -41,15 +41,16 @@
<style scoped lang="scss">
.login {
padding: 20px;
h2 {
text-align: center;
letter-spacing: 10px;
text-align: center;
}
.nut-form-item {
background: #f2f3f5;
border-radius: 20px;
margin-bottom: 20px;
border-radius: 20px;
background: #f2f3f5;
input {
background: transparent;

View File

@ -1,15 +1,27 @@
module.exports = {
root: true,
plugins: ['stylelint-order'],
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
extends: ['stylelint-config-standard', 'stylelint-config-property-sort-order-smacss'],
plugins: ['stylelint-order', 'stylelint-prettier'],
// customSyntax: 'postcss-html',
overrides: [
{
files: ['**/*.(css|html|vue)'],
customSyntax: 'postcss-html',
},
{
files: ['*.less', '**/*.less'],
customSyntax: 'postcss-less',
extends: ['stylelint-config-standard', 'stylelint-config-recommended-vue'],
},
],
rules: {
'selector-not-notation': null,
'import-notation': null,
'function-no-unknown': null,
'selector-class-pattern': null,
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
ignorePseudoClasses: ['global', 'deep'],
},
],
'selector-pseudo-element-no-unknown': [
@ -21,18 +33,14 @@ module.exports = {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'function', 'if', 'each', 'include', 'mixin'],
ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'function', 'if', 'each', 'include', 'mixin', 'extend'],
},
],
'no-empty-source': null,
'string-quotes': null,
'named-grid-areas-no-invalid': null,
'unicode-bom': 'never',
'no-descending-specificity': null,
'font-family-no-missing-generic-family-keyword': null,
'declaration-colon-space-after': 'always-single-line',
'declaration-colon-space-before': 'never',
// 'declaration-block-trailing-semicolon': 'always',
'rule-empty-line-before': [
'always',
{
@ -56,34 +64,8 @@ module.exports = {
},
'rules',
],
{ severity: 'warning' },
{ severity: 'error' },
],
},
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
overrides: [
{
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
extends: ['stylelint-config-recommended'],
rules: {
'keyframes-name-pattern': null,
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['deep', 'global'],
},
],
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted'],
},
],
},
},
{
files: ['*.less', '**/*.less'],
customSyntax: 'postcss-less',
extends: ['stylelint-config-standard', 'stylelint-config-recommended-vue'],
},
],
};

View File

@ -23,8 +23,8 @@
"types": ["vite/client"],
"removeComments": true,
"paths": {
"/@/*": ["src/*"],
"/#/*": ["types/*"]
"@/*": ["src/*"],
"#/*": ["types/*"]
}
},
"include": [

View File

@ -22,14 +22,14 @@ export default function ({ command, mode }: ConfigEnv): UserConfig {
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
},
// /@/xxxx => src/xxxx
// @/xxxx => src/xxxx
{
find: /\/@\//,
find: /@\//,
replacement: pathResolve('src') + '/',
},
// /#/xxxx => types/xxxx
// #/xxxx => types/xxxx
{
find: /\/#\//,
find: /#\//,
replacement: pathResolve('types') + '/',
},
],
@ -53,7 +53,7 @@ export default function ({ command, mode }: ConfigEnv): UserConfig {
preprocessorOptions: {
scss: {
// 配置 nutui 全局 scss 变量
additionalData: `@import "@nutui/nutui/dist/styles/variables.scss";@import '/@/styles/mixin.scss'; @import '/@/styles/vant.scss';`,
additionalData: `@import "@nutui/nutui/dist/styles/variables.scss";@import '@/styles/mixin.scss'; @import '@/styles/vant.scss';`,
},
},
},

View File

@ -3423,6 +3423,11 @@ css-functions-list@^3.1.0:
resolved "https://registry.yarnpkg.com/css-functions-list/-/css-functions-list-3.1.0.tgz#cf5b09f835ad91a00e5959bcfc627cd498e1321b"
integrity sha512-/9lCvYZaUbBGvYUgYGFJ4dcYiyqdhSjG7IPVluoV8A1ILjkF7ilmhp1OGUz8n+nmBcu0RNrQAzgD8B6FJbrt2w==
css-property-sort-order-smacss@~2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/css-property-sort-order-smacss/-/css-property-sort-order-smacss-2.2.0.tgz#c2cb4741e5580fe2f6d968ccde0946e8b689033c"
integrity sha512-nXutswsivIEBOrPo/OZw2KQjFPLvtg68aovJf6Kqrm3L6FmTvvFPaeDrk83hh0+pRJGuP3PeKJwMS0E6DFipdQ==
css-select@^4.1.3:
version "4.3.0"
resolved "https://registry.yarnpkg.com/css-select/-/css-select-4.3.0.tgz#db7129b2846662fd8628cfc496abb2b59e41529b"
@ -7234,6 +7239,11 @@ postcss-less@^6.0.0:
resolved "https://registry.yarnpkg.com/postcss-less/-/postcss-less-6.0.0.tgz#463b34c60f53b648c237f569aeb2e09149d85af4"
integrity sha512-FPX16mQLyEjLzEuuJtxA8X3ejDLNGGEG503d2YGZR5Ask1SpDN8KmZUMpzCvyalWRywAn1n1VOA5dcqfCLo5rg==
postcss-media-query-parser@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz#27b39c6f4d94f81b1a73b8f76351c609e5cef244"
integrity sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==
postcss-prefix-selector@^1.6.0:
version "1.16.0"
resolved "https://registry.yarnpkg.com/postcss-prefix-selector/-/postcss-prefix-selector-1.16.0.tgz#ad5b56f9a73a2c090ca7161049632c9d89bcb404"
@ -7249,6 +7259,11 @@ postcss-safe-parser@^6.0.0:
resolved "https://registry.yarnpkg.com/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz#bb4c29894171a94bc5c996b9a30317ef402adaa1"
integrity sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==
postcss-scss@^4.0.6:
version "4.0.6"
resolved "https://registry.yarnpkg.com/postcss-scss/-/postcss-scss-4.0.6.tgz#5d62a574b950a6ae12f2aa89b60d63d9e4432bfd"
integrity sha512-rLDPhJY4z/i4nVFZ27j9GqLxj1pwxE80eAzUNRMXtcpipFYIeowerzBgG3yJhMtObGEXidtIgbUpQ3eLDsf5OQ==
postcss-selector-parser@^6.0.13:
version "6.0.13"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz#d05d8d76b1e8e173257ef9d60b706a8e5e99bf1b"
@ -8371,10 +8386,22 @@ stylelint-config-html@>=1.0.0:
resolved "https://registry.yarnpkg.com/stylelint-config-html/-/stylelint-config-html-1.1.0.tgz#999db19aea713b7ff6dde92ada76e4c1bd812b66"
integrity sha512-IZv4IVESjKLumUGi+HWeb7skgO6/g4VMuAYrJdlqQFndgbj6WJAXPhaysvBiXefX79upBdQVumgYcdd17gCpjQ==
stylelint-config-prettier@^9.0.5:
version "9.0.5"
resolved "https://registry.yarnpkg.com/stylelint-config-prettier/-/stylelint-config-prettier-9.0.5.tgz#9f78bbf31c7307ca2df2dd60f42c7014ee9da56e"
integrity sha512-U44lELgLZhbAD/xy/vncZ2Pq8sh2TnpiPvo38Ifg9+zeioR+LAkHu0i6YORIOxFafZoVg0xqQwex6e6F25S5XA==
stylelint-config-property-sort-order-smacss@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/stylelint-config-property-sort-order-smacss/-/stylelint-config-property-sort-order-smacss-9.1.0.tgz#72968ab6f38cc23e234a28122fd0808266f9c5cd"
integrity sha512-TijYeDoDgHAFjpn9NnziQrmUCGrm2AM4e1HzsdI2mCWBRkQRuewc343YqDwdFgQ5eHoMZ3JRL02i72W3vktuDA==
dependencies:
css-property-sort-order-smacss "~2.2.0"
stylelint-order "^6.0.2"
stylelint-config-recommended-scss@^12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-12.0.0.tgz#9d9e82c46012649f11bfebcbc788f58e61860f33"
integrity sha512-5Bb2mlGy6WLa30oNeKpZvavv2lowJUsUJO25+OA68GFTemlwd1zbFsL7q0bReKipOSU3sG47hKneZ6Nd+ctrFA==
dependencies:
postcss-scss "^4.0.6"
stylelint-config-recommended "^12.0.0"
stylelint-scss "^5.0.0"
stylelint-config-recommended-vue@^1.4.0:
version "1.4.0"
@ -8390,11 +8417,31 @@ stylelint-config-recommended@>=6.0.0:
resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-9.0.0.tgz#1c9e07536a8cd875405f8ecef7314916d94e7e40"
integrity sha512-9YQSrJq4NvvRuTbzDsWX3rrFOzOlYBmZP+o513BJN/yfEmGSr0AxdvrWs0P/ilSpVV/wisamAHu5XSk8Rcf4CQ==
stylelint-config-recommended@^12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-12.0.0.tgz#d0993232fca017065fd5acfcb52dd8a188784ef4"
integrity sha512-x6x8QNARrGO2sG6iURkzqL+Dp+4bJorPMMRNPScdvaUK8PsynriOcMW7AFDKqkWAS5wbue/u8fUT/4ynzcmqdQ==
stylelint-config-recommended@^13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-13.0.0.tgz#c48a358cc46b629ea01f22db60b351f703e00597"
integrity sha512-EH+yRj6h3GAe/fRiyaoO2F9l9Tgg50AOFhaszyfov9v6ayXJ1IkSHwTxd7lB48FmOeSGDPLjatjO11fJpmarkQ==
stylelint-config-standard-scss@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-standard-scss/-/stylelint-config-standard-scss-10.0.0.tgz#159a54a01b80649bf0143fa7ba086b676a1a749e"
integrity sha512-bChBEo1p3xUVWh/wenJI+josoMk21f2yuLDGzGjmKYcALfl2u3DFltY+n4UHswYiXghqXaA8mRh+bFy/q1hQlg==
dependencies:
stylelint-config-recommended-scss "^12.0.0"
stylelint-config-standard "^33.0.0"
stylelint-config-standard@^33.0.0:
version "33.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-33.0.0.tgz#1f7bb299153a53874073e93829e37a475842f0f9"
integrity sha512-eyxnLWoXImUn77+ODIuW9qXBDNM+ALN68L3wT1lN2oNspZ7D9NVGlNHb2QCUn4xDug6VZLsh0tF8NyoYzkgTzg==
dependencies:
stylelint-config-recommended "^12.0.0"
stylelint-config-standard@^34.0.0:
version "34.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-34.0.0.tgz#309f3c48118a02aae262230c174282e40e766cf4"
@ -8402,7 +8449,7 @@ stylelint-config-standard@^34.0.0:
dependencies:
stylelint-config-recommended "^13.0.0"
stylelint-order@^6.0.3:
stylelint-order@^6.0.2, stylelint-order@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-6.0.3.tgz#160b78650bd90463241b992581efee7159baefc2"
integrity sha512-1j1lOb4EU/6w49qZeT2SQVJXm0Ht+Qnq9GMfUa3pMwoyojIWfuA+JUDmoR97Bht1RLn4ei0xtLGy87M7d29B1w==
@ -8410,6 +8457,23 @@ stylelint-order@^6.0.3:
postcss "^8.4.21"
postcss-sorting "^8.0.2"
stylelint-prettier@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/stylelint-prettier/-/stylelint-prettier-3.0.0.tgz#57028b99866ed4c3ae045ddd891bf9a77d274726"
integrity sha512-kIks1xw6np0zElokMT2kP6ar3S4MBoj6vUtPJuND1pFELMpZxVS/0uHPR4HDAVn0WAD3I5oF0IA3qBFxBpMkLg==
dependencies:
prettier-linter-helpers "^1.0.0"
stylelint-scss@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-5.0.1.tgz#b33a6580b5734eace083cfc2cc3021225e28547f"
integrity sha512-n87iCRZrr2J7//I/QFsDXxFLnHKw633U4qvWZ+mOW6KDAp/HLj06H+6+f9zOuTYy+MdGdTuCSDROCpQIhw5fvQ==
dependencies:
postcss-media-query-parser "^0.2.3"
postcss-resolve-nested-selector "^0.1.1"
postcss-selector-parser "^6.0.13"
postcss-value-parser "^4.2.0"
stylelint@^15.10.1:
version "15.10.1"
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-15.10.1.tgz#93f189958687e330c106b010cbec0c41dcae506d"