diff --git a/README.md b/README.md
index 4feea58..f4b9525 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,37 @@
# axios-miniprogram
-[](https://codecov.io/gh/zjx0905/axios-miniprogram) [](https://badge.fury.io/js/axios-miniprogram) [](https://opensource.org/licenses/MIT)
+
+
+
+
+
+
+
+
+
+
+
[中文文档](https://axios-miniprogram.com)
## 安装
+使用 npm:
+
+```bash
+$ npm i axios-miniprogram
+```
+
+yarn
+
```bash
$ yarn add axios-miniprogram
```
-或者
+pnpm
```bash
-$ npm i axios-miniprogram
+$ pnpm i axios-miniprogram
```
[原生小程序也可以直接下载源码包](https://github.com/zjx0905/axios-miniprogram/releases)
@@ -36,6 +54,7 @@ axios-miniprogram 是一款为小程序平台量身定制的轻量级请求库
- 支持 自定义错误处理。
- 支持 自定义平台适配器
- 支持 上传/下载
+- 支持 派生领域
## 目前支持的平台
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 40f805e..f2d2a15 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -1,13 +1,152 @@
import { defineConfig } from 'vitepress';
import { VitePWA } from 'vite-plugin-pwa';
-import { themeConfig } from './themeConfig';
+import { createIntroMD } from './utils/createIntroMD';
+
+createIntroMD();
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'axios-miniprogram',
+ titleTemplate: ':title - axios',
description: '基于 Promise 的 HTTP 请求库,适用于各大小程序平台。',
srcDir: 'pages',
- themeConfig,
+ themeConfig: {
+ // https://vitepress.dev/reference/default-theme-config
+ nav: [
+ {
+ text: '指南',
+ link: '/intro',
+ },
+ {
+ text: '配置',
+ link: '/config/preview',
+ },
+ {
+ text: 'API',
+ link: '/api/interceptors',
+ },
+ ],
+
+ sidebar: [
+ {
+ text: '指南',
+ items: [
+ {
+ text: '简介',
+ link: '/intro',
+ },
+ {
+ text: '开始',
+ link: '/start',
+ },
+ ],
+ },
+ {
+ text: '配置',
+ items: [
+ {
+ text: '默认配置',
+ link: '/config/preview',
+ },
+ {
+ text: 'method',
+ link: '/config/method',
+ },
+ {
+ text: 'dataType',
+ link: '/config/data-type',
+ },
+ {
+ text: 'responseType',
+ link: '/config/response-type',
+ },
+ {
+ text: 'validateStatus',
+ link: '/config/validate-status',
+ },
+ {
+ text: 'paramsSerializer',
+ link: '/config/params-serializer',
+ },
+ {
+ text: 'transformRequest',
+ link: '/config/transform-request',
+ },
+ {
+ text: 'transformResponse',
+ link: '/config/transform-response',
+ },
+ {
+ text: 'errorHandler',
+ link: '/config/error-handler',
+ },
+ {
+ text: 'upload',
+ link: '/config/upload',
+ },
+ {
+ text: 'download',
+ link: '/config/download',
+ },
+ {
+ text: 'adapter',
+ link: '/config/adapter',
+ },
+ ],
+ },
+ {
+ text: 'API',
+ items: [
+ {
+ text: 'interceptors',
+ link: '/api/interceptors',
+ },
+ {
+ text: 'CancelToken',
+ link: '/api/cancel-token',
+ },
+ {
+ text: 'isCancel',
+ link: '/api/is-cancel',
+ },
+ {
+ text: 'isAxiosError',
+ link: '/api/is-axios-error',
+ },
+ {
+ text: 'getUri',
+ link: '/api/get-uri',
+ },
+ {
+ text: 'create',
+ link: '/api/create',
+ },
+ {
+ text: 'fork ',
+ link: '/api/fork',
+ },
+ {
+ text: 'Axios',
+ link: '/api/axios',
+ },
+ ],
+ },
+ ],
+
+ socialLinks: [
+ { icon: 'github', link: 'https://github.com/zjx0905/axios-miniprogram' },
+ ],
+
+ returnToTopLabel: '返回顶部',
+ outlineTitle: '导航栏',
+ darkModeSwitchLabel: '主题',
+ footer: {
+ message:
+ '根据 MIT License 发布',
+ copyright:
+ 'Copyright © 2020-至今 zjx0905',
+ },
+ },
vite: {
plugins: [
VitePWA({
diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts
new file mode 100644
index 0000000..6cab559
--- /dev/null
+++ b/docs/.vitepress/theme/index.ts
@@ -0,0 +1,5 @@
+import theme from 'vitepress/theme';
+
+export default {
+ ...theme,
+};
diff --git a/docs/.vitepress/themeConfig.ts b/docs/.vitepress/themeConfig.ts
deleted file mode 100644
index 46eeb82..0000000
--- a/docs/.vitepress/themeConfig.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { DefaultTheme } from 'vitepress';
-
-export const themeConfig: DefaultTheme.Config = {
- // https://vitepress.dev/reference/default-theme-config
- nav: [
- { text: '指南', link: '/guide/introduction' },
- { text: '配置', link: '/config/preview' },
- { text: 'API', link: '/api/interceptors' },
- ],
-
- sidebar: [
- {
- text: '指南',
- items: [
- { text: '简介', link: '/guide/introduction' },
- { text: '快速上手', link: '/guide/quick-start' },
- ],
- },
- {
- text: '配置',
- items: [
- { text: '默认配置', link: '/config/preview' },
- { text: 'method', link: '/config/method' },
- { text: 'dataType', link: '/config/data-type' },
- { text: 'responseType', link: '/config/response-type' },
- { text: 'validateStatus', link: '/config/validate-status' },
- { text: 'paramsSerializer', link: '/config/params-serializer' },
- { text: 'transformRequest', link: '/config/transform-request' },
- { text: 'transformResponse', link: '/config/transform-response' },
- { text: 'errorHandler', link: '/config/error-handler' },
- { text: 'upload', link: '/config/upload' },
- { text: 'download', link: '/config/download' },
- { text: 'adapter', link: '/config/adapter' },
- ],
- },
- {
- text: 'API',
- items: [
- { text: 'interceptors', link: '/api/interceptors' },
- { text: 'CancelToken', link: '/api/cancel-token' },
- { text: 'isCancel', link: '/api/is-cancel' },
- { text: 'isAxiosError', link: '/api/is-axios-error' },
- { text: 'getUri', link: '/api/get-uri' },
- { text: 'create', link: '/api/create' },
- { text: 'fork', link: '/api/fork' },
- { text: 'Axios', link: '/api/axios' },
- ],
- },
- ],
-
- socialLinks: [
- { icon: 'github', link: 'https://github.com/zjx0905/axios-miniprogram' },
- ],
-
- returnToTopLabel: '返回顶部',
- outlineTitle: '导航栏',
- darkModeSwitchLabel: '主题',
-};
diff --git a/docs/.vitepress/utils/createIntroMD.ts b/docs/.vitepress/utils/createIntroMD.ts
new file mode 100644
index 0000000..13a118c
--- /dev/null
+++ b/docs/.vitepress/utils/createIntroMD.ts
@@ -0,0 +1,9 @@
+import { copyFileSync } from 'node:fs';
+import { resolve } from '../../../scripts/utils';
+
+const readmePath = resolve('README.md');
+const introPath = resolve('docs/pages/intro.md');
+
+export function createIntroMD() {
+ copyFileSync(readmePath, introPath);
+}
diff --git a/docs/pages/index.md b/docs/pages/index.md
index 8ae4f48..8a34fe8 100644
--- a/docs/pages/index.md
+++ b/docs/pages/index.md
@@ -5,20 +5,26 @@ layout: home
hero:
name: 'axios-miniprogram'
text: '基于 Promise 的 HTTP 请求库,适用于各大小程序平台。'
- tagline: My great project tagline
+ tagline: 通用小程序请求库
actions:
- - theme: brand
- text: 介绍
- link: /guide/introduction
- theme: alt
- text: 安装
- link: /guide/quick-start
+ text: 简介
+ link: /intro
+ - theme: brand
+ text: 开始
+ link: /start
features:
- - title: 轻量
- details: 不足 10kb
+ - title: 节省空间
+ details: 包尺寸仅 10 kb,不会占用您太多空间
+ icon: 🤌
+ - title: 简单易用
+ details: 提供了简单易用的 API,并且具有很强的可拓展性
+ icon: 🎯
+ - title: 方便快捷
+ details: 除了提供 npm 安装包以外,还为原生小程序提供开箱即用的源码包
+ icon: 📦
- title: 跨平台
- details: 兼容各个小程序
- - title: 方便
- details: 任何形式的项目都可使用
+ details: 我很全能,所有小程序平台都可以兼容
+ icon: 🎭
---
diff --git a/docs/pages/guide/introduction.md b/docs/pages/intro.md
similarity index 80%
rename from docs/pages/guide/introduction.md
rename to docs/pages/intro.md
index 6c12374..f4b9525 100644
--- a/docs/pages/guide/introduction.md
+++ b/docs/pages/intro.md
@@ -1,28 +1,37 @@
----
-title: 简介
-sidebarDepth: 1
-lastUpdated: true
-sitemap:
- priority: 0.8
----
-
# axios-miniprogram
-[](https://badge.fury.io/js/axios-miniprogram)
-[](https://opensource.org/licenses/MIT)
+
+
+
+
+
+
+
+
+
+
+
[中文文档](https://axios-miniprogram.com)
## 安装
+使用 npm:
+
+```bash
+$ npm i axios-miniprogram
+```
+
+yarn
+
```bash
$ yarn add axios-miniprogram
```
-或者
+pnpm
```bash
-$ npm i axios-miniprogram
+$ pnpm i axios-miniprogram
```
[原生小程序也可以直接下载源码包](https://github.com/zjx0905/axios-miniprogram/releases)
@@ -45,6 +54,7 @@ axios-miniprogram 是一款为小程序平台量身定制的轻量级请求库
- 支持 自定义错误处理。
- 支持 自定义平台适配器
- 支持 上传/下载
+- 支持 派生领域
## 目前支持的平台
diff --git a/docs/pages/guide/quick-start.md b/docs/pages/start.md
similarity index 100%
rename from docs/pages/guide/quick-start.md
rename to docs/pages/start.md
diff --git a/docs/tsconfig.json b/docs/tsconfig.json
index d94a26b..6279e2d 100644
--- a/docs/tsconfig.json
+++ b/docs/tsconfig.json
@@ -7,6 +7,7 @@
"lib": ["DOM", "ESNext"],
"strict": true,
"jsx": "preserve",
+ "allowJs": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
@@ -14,7 +15,7 @@
"noUnusedLocals": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
- "types": ["vite-plugin-pwa/client", "vitepress"]
+ "types": ["vitepress"]
},
"include": [
"./.vitepress/**/*.ts",
diff --git a/package.json b/package.json
index 69c3c85..500654d 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
"bugs": {
"url": "https://github.com/zjx0905/axios-miniprogram/issues"
},
- "homepage": "https://github.com/zjx0905/axios-miniprogram#readme",
+ "homepage": "https://axios-miniprogram.com",
"license": "MIT",
"scripts": {
"cz": "czg",