mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-17 13:20:52 +08:00
refactor: use lyla instead of axios
This commit is contained in:
parent
f18f444a40
commit
357e4fee74
@ -5,6 +5,7 @@
|
||||
### Fixes
|
||||
|
||||
- Fix `n-tabs` has unexpected line animation when nested with `n-tabs`, closes [#2689](https://github.com/TuSimple/naive-ui/issues/2689).
|
||||
- Fix `n-tree-select` unexpected warning.
|
||||
|
||||
### Feats
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
### Fixes
|
||||
|
||||
- 修复 `n-tabs` 中嵌套 `n-tabs`,内部的线条会有一次多余的动画,关闭 [#2689](https://github.com/TuSimple/naive-ui/issues/2689)
|
||||
- 修复 `n-tree-select` 无意义 warning
|
||||
|
||||
### Feats
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
||||
"@vue/server-renderer": "^3.2.18",
|
||||
"@vue/test-utils": "2.0.0-rc.16",
|
||||
"autoprefixer": "^10.2.6",
|
||||
"axios": "^0.26.0",
|
||||
"lyla": "^0.4.0",
|
||||
"babel-jest": "^27.0.2",
|
||||
"codesandbox": "^2.2.3",
|
||||
"cross-env": "^7.0.3",
|
||||
|
@ -847,7 +847,6 @@ export default defineComponent({
|
||||
internalScrollablePadding={this.menuPadding}
|
||||
internalFocusable={false}
|
||||
internalCheckboxFocusable={false}
|
||||
onDrop={this.onDrop}
|
||||
onLoad={this.onLoad}
|
||||
onUpdateCheckedKeys={
|
||||
this.handleUpdateCheckedKeys
|
||||
|
@ -21,8 +21,7 @@ User `custom-request` to customize upload request.
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
import axios from 'axios'
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import { lyla } from 'lyla'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import type { UploadCustomRequestOptions } from 'naive-ui'
|
||||
|
||||
@ -49,16 +48,17 @@ export default defineComponent({
|
||||
})
|
||||
}
|
||||
formData.append(file.name, file.file as File)
|
||||
axios
|
||||
.post(action as string, formData, {
|
||||
lyla
|
||||
.post(action as string, {
|
||||
withCredentials,
|
||||
headers,
|
||||
onUploadProgress: ({ loaded, total }) => {
|
||||
onProgress({ percent: Math.ceil((loaded / total) * 100) })
|
||||
headers: headers as Record<string, string>,
|
||||
body: formData,
|
||||
onUploadProgress: ({ percent }) => {
|
||||
onProgress({ percent: Math.ceil(percent) })
|
||||
}
|
||||
} as AxiosRequestConfig)
|
||||
.then((e) => {
|
||||
message.success(e.data)
|
||||
})
|
||||
.then(({ json }) => {
|
||||
message.success(json)
|
||||
onFinish()
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -21,10 +21,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
import axios from 'axios'
|
||||
import type { AxiosRequestConfig } from 'axios'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import type { UploadCustomRequestOptions } from 'naive-ui'
|
||||
import { useMessage, UploadCustomRequestOptions } from 'naive-ui'
|
||||
import { lyla } from 'lyla'
|
||||
|
||||
export default defineComponent({
|
||||
setup () {
|
||||
@ -49,16 +47,17 @@ export default defineComponent({
|
||||
})
|
||||
}
|
||||
formData.append(file.name, file.file as File)
|
||||
axios
|
||||
.post(action as string, formData, {
|
||||
lyla
|
||||
.post(action as string, {
|
||||
withCredentials,
|
||||
headers,
|
||||
onUploadProgress: ({ loaded, total }) => {
|
||||
onProgress({ percent: Math.ceil((loaded / total) * 100) })
|
||||
headers: headers as Record<string, string>,
|
||||
body: formData,
|
||||
onUploadProgress: ({ percent }) => {
|
||||
onProgress({ percent: Math.ceil(percent) })
|
||||
}
|
||||
} as AxiosRequestConfig)
|
||||
.then((e) => {
|
||||
message.success(e.data)
|
||||
})
|
||||
.then(({ json }) => {
|
||||
message.success(json)
|
||||
onFinish()
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -73,11 +73,6 @@ module.exports = {
|
||||
build: {
|
||||
outDir: 'site',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
axios: ['axios']
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
babel({
|
||||
babelHelpers: 'bundled'
|
||||
|
Loading…
Reference in New Issue
Block a user