提交 e9e9e64c 作者: 方治民

合并分支 '3.x' 到 'main'

3.x

查看合并请求 !18
import type { Plugin } from 'vite'
// https://github.com/ErKeLost/unplugin-imagemin
import imagemin from 'unplugin-imagemin/vite'
export function configImageminPlugin(): Plugin {
return imagemin({
// https://github.com/ErKeLost/unplugin-imagemin#warning
// mode: 'sharp',
cache: true,
})
}
...@@ -26,9 +26,6 @@ export function createVitePlugins(viteEnv: ViteEnv) { ...@@ -26,9 +26,6 @@ export function createVitePlugins(viteEnv: ViteEnv) {
// unplugin-vue-components // unplugin-vue-components
vitePlugins.push(configImportPlugin()) vitePlugins.push(configImportPlugin())
// unplugin-imagemin
// vitePlugins.push(configImageminPlugin())
// uni-app // uni-app
vitePlugins.push(configUniPlugin()) vitePlugins.push(configUniPlugin())
......
import fs from 'node:fs'
import type { Plugin } from 'vite' import type { Plugin } from 'vite'
import fs from 'fs'
import prettier from 'prettier' import prettier from 'prettier'
// uni-app // uni-app
...@@ -11,12 +11,17 @@ import tags from '@dcloudio/uni-helper-json/dist/tags.json' ...@@ -11,12 +11,17 @@ import tags from '@dcloudio/uni-helper-json/dist/tags.json'
* 根据 @dcloudio/uni-helper-json 生成组件 .d.ts 描述文件,对组件进行高亮展示 * 根据 @dcloudio/uni-helper-json 生成组件 .d.ts 描述文件,对组件进行高亮展示
*/ */
function generateUniComponentsTypes() { function generateUniComponentsTypes() {
const components = Object.keys(tags).map((key) => `'${key}': typeof HTMLElement`) const components = Object.keys(tags).map((key) => `'${key}': UniComponent`)
const content = ` const content = `
// generated by @dcloudio/uni-helper-json/dist/tags.json // generated by @dcloudio/uni-helper-json/dist/tags.json
declare module 'vue' { declare module 'vue' {
// uni-app 内置组件高亮 // shime-uni.d.ts
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentCustomOptions extends Hooks {}
// uni-app components
interface UniComponent extends HTMLElement {}
export interface GlobalComponents { export interface GlobalComponents {
${components.join(',\n\t')} ${components.join(',\n\t')}
} }
...@@ -28,7 +33,7 @@ function generateUniComponentsTypes() { ...@@ -28,7 +33,7 @@ function generateUniComponentsTypes() {
parser: 'typescript', parser: 'typescript',
...require('../../prettier.config'), ...require('../../prettier.config'),
}) })
fs.writeFileSync('./types/uni-components.d.ts', formatted, 'utf8') fs.writeFileSync('./types/uni.d.ts', formatted, 'utf8')
} }
/** /**
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
- [Lodash](https://github.com/lodash/lodash) 函数库 - [Lodash](https://github.com/lodash/lodash) 函数库
- [Dayjs](https://github.com/iamkun/dayjs) 时间库 - [Dayjs](https://github.com/iamkun/dayjs) 时间库
- [@vueuse/core](https://github.com/vueuse/vueuse) Vue2/3 实用工具集 - [@vueuse/core](https://github.com/vueuse/vueuse) Vue2/3 实用工具集
- [mock.js](https://github.com/nuysoft/Mock) 数据模拟 - [faker-js](https://github.com/faker-js/faker) 数据模拟
- [UnoCSS](https://github.com/unocss/unocss) UnoCSS - [UnoCSS](https://github.com/unocss/unocss) UnoCSS
### 网络 ### 网络
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<!-- prettier-ignore --> <!-- prettier-ignore -->
- [HBuilderX Latest](https://www.dcloud.io/hbuilderx.html) - [HBuilderX Latest](https://www.dcloud.io/hbuilderx.html)
- [Vite v4.x](https://vitejs.dev) - [Vite](https://vitejs.dev)
### 其他插件 ### 其他插件
......
...@@ -66,27 +66,28 @@ ...@@ -66,27 +66,28 @@
} }
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-3070820230323001", "@dcloudio/uni-app": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-app-plus": "3.0.0-3070820230323001", "@dcloudio/uni-app-plus": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-components": "3.0.0-3070820230323001", "@dcloudio/uni-components": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-h5": "3.0.0-3070820230323001", "@dcloudio/uni-h5": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-alipay": "3.0.0-3070820230323001", "@dcloudio/uni-mp-alipay": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-baidu": "3.0.0-3070820230323001", "@dcloudio/uni-mp-baidu": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-jd": "3.0.0-3070820230323001", "@dcloudio/uni-mp-jd": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-3070820230323001", "@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-lark": "3.0.0-3070820230323001", "@dcloudio/uni-mp-lark": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-qq": "3.0.0-3070820230323001", "@dcloudio/uni-mp-qq": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-toutiao": "3.0.0-3070820230323001", "@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-mp-weixin": "3.0.0-3070820230323001", "@dcloudio/uni-mp-weixin": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3070820230323001", "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-ui": "^1.4.26", "@dcloudio/uni-ui": "^1.4.26",
"@faker-js/faker": "^7.6.0",
"@vue/runtime-core": "^3.2.47", "@vue/runtime-core": "^3.2.47",
"@vueuse/core": "^9.13.0", "@vueuse/core": "^9.13.0",
"axios": "^0.26.1", "axios": "^0.26.1",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"nanoid": "^4.0.1", "nanoid": "^4.0.2",
"pinia": "^2.0.33", "pinia": "^2.0.33",
"qs": "~6.9.7", "qs": "~6.9.7",
"stompjs": "^2.3.3", "stompjs": "^2.3.3",
...@@ -101,15 +102,15 @@ ...@@ -101,15 +102,15 @@
"@commitlint/cli": "^17.5.0", "@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4", "@commitlint/config-conventional": "^17.4.4",
"@dcloudio/types": "^3.3.2", "@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "3.0.0-3070820230323001", "@dcloudio/uni-automator": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-cli-shared": "3.0.0-3070820230323001", "@dcloudio/uni-cli-shared": "3.0.0-alpha-3071220230324001",
"@dcloudio/uni-helper-json": "^1.0.13", "@dcloudio/uni-helper-json": "^1.0.13",
"@dcloudio/uni-stacktracey": "3.0.0-3070820230323001", "@dcloudio/uni-stacktracey": "3.0.0-alpha-3071220230324001",
"@dcloudio/vite-plugin-uni": "3.0.0-3070820230323001", "@dcloudio/vite-plugin-uni": "3.0.0-alpha-3071220230324001",
"@iconify/json": "^2.2.39", "@iconify/json": "^2.2.39",
"@types/crypto-js": "^4.1.1", "@types/crypto-js": "^4.1.1",
"@types/lodash-es": "^4.17.7", "@types/lodash-es": "^4.17.7",
"@types/node": "^18.15.6", "@types/node": "^18.15.10",
"@types/prettier": "^2.7.2", "@types/prettier": "^2.7.2",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/stompjs": "^2.3.5", "@types/stompjs": "^2.3.5",
...@@ -138,7 +139,7 @@ ...@@ -138,7 +139,7 @@
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-less": "^6.0.0", "postcss-less": "^6.0.0",
"prettier": "^2.8.6", "prettier": "^2.8.7",
"rimraf": "^4.4.1", "rimraf": "^4.4.1",
"sass": "^1.60.0", "sass": "^1.60.0",
"sort-package-json": "^2.4.1", "sort-package-json": "^2.4.1",
...@@ -148,13 +149,11 @@ ...@@ -148,13 +149,11 @@
"stylelint-config-recommended": "^9.0.0", "stylelint-config-recommended": "^9.0.0",
"stylelint-config-standard": "^29.0.0", "stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"stylus": "^0.59.0", "terser": "^5.16.8",
"terser": "^5.16.6", "typescript": "^5.0.2",
"typescript": "^4.9.5",
"unocss": "^0.50.6", "unocss": "^0.50.6",
"unocss-preset-weapp": "^0.5.2", "unocss-preset-weapp": "^0.5.2",
"unplugin-auto-import": "^0.15.2", "unplugin-auto-import": "^0.15.2",
"unplugin-imagemin": "^0.3.11",
"unplugin-vue-components": "^0.24.1", "unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1", "vite": "^4.2.1",
"vue-eslint-parser": "^9.1.0" "vue-eslint-parser": "^9.1.0"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</view> </view>
</template> </template>
<style> <style scoped>
.empty { .empty {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</view> </view>
</template> </template>
<style> <style scoped>
page { page {
background-color: #fff; background-color: #fff;
font-weight: normal; font-weight: normal;
......
...@@ -259,12 +259,18 @@ export class VAxios { ...@@ -259,12 +259,18 @@ export class VAxios {
const { requestOptions } = this.options const { requestOptions } = this.options
const opt: RequestOptions = Object.assign({}, requestOptions, options) let opt: RequestOptions = Object.assign({}, requestOptions, options)
const { beforeRequestHook, requestCatchHook, transformRequestHook } = transform || {} const { beforeRequestHook, requestCatchHook, transformRequestHook, inject } = transform || {}
if (inject && isFunction(inject)) {
const result = inject(conf, opt)
conf = result.config
opt = result.options
}
if (beforeRequestHook && isFunction(beforeRequestHook)) { if (beforeRequestHook && isFunction(beforeRequestHook)) {
conf = beforeRequestHook(conf, opt) conf = beforeRequestHook(conf, opt)
} }
conf.requestOptions = opt conf.requestOptions = opt
conf = this.supportFormData(conf) conf = this.supportFormData(conf)
......
...@@ -12,6 +12,15 @@ export interface CreateAxiosOptions extends AxiosRequestConfig { ...@@ -12,6 +12,15 @@ export interface CreateAxiosOptions extends AxiosRequestConfig {
export abstract class AxiosTransform { export abstract class AxiosTransform {
/** /**
* 注入自定义配置,在请求方法调用时
* 允许动态修改本次请求的 config 和 options
*/
inject?: (
config: AxiosRequestConfig,
options: RequestOptions,
) => { config: AxiosRequestConfig; options: RequestOptions }
/**
* @description: Process configuration before request * @description: Process configuration before request
* @description: Process configuration before request * @description: Process configuration before request
*/ */
......
...@@ -267,8 +267,14 @@ export const defHttp = createAxios({ ...@@ -267,8 +267,14 @@ export const defHttp = createAxios({
// other api url // other api url
// export const otherHttp = createAxios({ // export const otherHttp = createAxios({
// requestOptions: { // transform: {
// apiUrl: 'xxx', // inject: (config: AxiosRequestConfig<any>, options: http.RequestOptions) => {
// urlPrefix: 'xxx', // // TODO: 根据实际项目配置
// }, // return { config, options }
// }); // },
// },
// requestOptions: {
// apiUrl: 'xxx',
// urlPrefix: 'xxx',
// },
// })
// generated by @dcloudio/uni-helper-json/dist/tags.json
declare module 'vue' {
// uni-app 内置组件高亮
export interface GlobalComponents {
block: typeof HTMLElement
view: typeof HTMLElement
'scroll-view': typeof HTMLElement
'match-media': typeof HTMLElement
swiper: typeof HTMLElement
'swiper-item': typeof HTMLElement
'movable-view': typeof HTMLElement
'movable-area': typeof HTMLElement
text: typeof HTMLElement
'rich-text': typeof HTMLElement
progress: typeof HTMLElement
button: typeof HTMLElement
'checkbox-group': typeof HTMLElement
checkbox: typeof HTMLElement
form: typeof HTMLElement
input: typeof HTMLElement
label: typeof HTMLElement
picker: typeof HTMLElement
'picker-view': typeof HTMLElement
'radio-group': typeof HTMLElement
radio: typeof HTMLElement
slider: typeof HTMLElement
switch: typeof HTMLElement
textarea: typeof HTMLElement
navigator: typeof HTMLElement
audio: typeof HTMLElement
image: typeof HTMLElement
video: typeof HTMLElement
map: typeof HTMLElement
canvas: typeof HTMLElement
'web-view': typeof HTMLElement
'cover-view': typeof HTMLElement
'cover-image': typeof HTMLElement
icon: typeof HTMLElement
'picker-view-column': typeof HTMLElement
camera: typeof HTMLElement
'live-player': typeof HTMLElement
'live-pusher': typeof HTMLElement
'open-data': typeof HTMLElement
ad: typeof HTMLElement
'ad-draw': typeof HTMLElement
'navigation-bar': typeof HTMLElement
'custom-tab-bar': typeof HTMLElement
'page-meta': typeof HTMLElement
editor: typeof HTMLElement
'unicloud-db': typeof HTMLElement
}
}
export {}
// generated by @dcloudio/uni-helper-json/dist/tags.json
declare module 'vue' {
// shime-uni.d.ts
type Hooks = App.AppInstance & Page.PageInstance
interface ComponentCustomOptions extends Hooks {}
// uni-app components
interface UniComponent extends HTMLElement {}
export interface GlobalComponents {
block: UniComponent
view: UniComponent
'scroll-view': UniComponent
'match-media': UniComponent
swiper: UniComponent
'swiper-item': UniComponent
'movable-view': UniComponent
'movable-area': UniComponent
text: UniComponent
'rich-text': UniComponent
progress: UniComponent
button: UniComponent
'checkbox-group': UniComponent
checkbox: UniComponent
form: UniComponent
input: UniComponent
label: UniComponent
picker: UniComponent
'picker-view': UniComponent
'radio-group': UniComponent
radio: UniComponent
slider: UniComponent
switch: UniComponent
textarea: UniComponent
navigator: UniComponent
audio: UniComponent
image: UniComponent
video: UniComponent
map: UniComponent
canvas: UniComponent
'web-view': UniComponent
'cover-view': UniComponent
'cover-image': UniComponent
icon: UniComponent
'picker-view-column': UniComponent
camera: UniComponent
'live-player': UniComponent
'live-pusher': UniComponent
'open-data': UniComponent
ad: UniComponent
'ad-draw': UniComponent
'navigation-bar': UniComponent
'custom-tab-bar': UniComponent
'page-meta': UniComponent
editor: UniComponent
'unicloud-db': UniComponent
}
}
export {}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论