Compare commits

...

62 Commits

Author SHA1 Message Date
chenjiahan
bbb6a6ef2a release: 4.0.0-rc.5 2022-10-07 23:32:35 +08:00
neverland
9c6b416bfb
test(DatePicker): migrate legacy test cases (#11123) 2022-10-07 23:24:03 +08:00
neverland
baa9c33dd4
fix(DatePicker): format value when exceed max date (#11122) 2022-10-07 23:04:56 +08:00
neverland
137a1b9cb7
docs(Field): add label-align demo (#11121) 2022-10-07 10:26:27 +08:00
chenjiahan
d49c1fb94a release: @vant/cli 5.0.2 2022-10-07 10:09:33 +08:00
neverland
2d981afde2
fix(cli): duplicate vue in first dev (#11120)
* fix(cli): duplicate vue in first dev

* docs: add changelog
2022-10-07 10:08:46 +08:00
neverland
19ce1d205d
feat(cli): using @vant/cli v5 in template (#11119) 2022-10-07 10:03:11 +08:00
neverland
9a95275cf1
docs(changelog): @vant/cli 5.0.1 (#11118) 2022-10-06 17:04:50 +08:00
chenjiahan
843c167376 release: @vant/cli 5.0.1 2022-10-06 17:03:15 +08:00
neverland
711652ad90
feat(cli): bump jest v29 (#11117) 2022-10-06 17:01:29 +08:00
neverland
f94897cb24
fix(Tabs): incorrect nav scroll animation in some cases (#11116)
* fix(Tabs): incorrect nav scroll animation in some cases

* chore: fix snapshot
2022-10-06 16:23:05 +08:00
neverland
d60096aff2
fix(Tabs): scroll position when using nav-bottom slot (#11115) 2022-10-06 16:07:12 +08:00
neverland
3d7ca9b490
docs: add faq of uni-app (#11114) 2022-10-05 09:28:28 +08:00
neverland
ef80a72e58
fix(Field): icon position when label align is top (#11112) 2022-10-04 09:21:45 +08:00
sunhao
ee923beecf
feat: add label-position:top for field and form (#11102)
Co-authored-by: redsun1992 <sunhao@starwrap.net>
2022-10-04 09:01:14 +08:00
neverland
b61158aaee
perf(cli): code split documents (#11111) 2022-10-04 08:47:43 +08:00
neverland
9d55f2d6b8
docs(Navbar): update clickable description (#11110) 2022-10-03 21:47:42 +08:00
哭你几哇
ea0ba1fcf1
feat(nav-bar): add clickable prop to nav-bar component (#11048)
* feat: add clickable prop to nav-bar

* test(nav-bar): add clickable prop test case
2022-10-03 21:43:32 +08:00
neverland
9f2eb92172
feat(Loading): add icon slot (#11109)
* feat(Loading): add icon slot

* chore: update snapshot
2022-10-03 21:36:02 +08:00
Gavin
59d5d76dbe
feat(Stepper): add auto-fixed prop (#11071)
* perf: improve the type of setTimeout with 'ReturnType<typeof setTimeout>'

* fix: fix type 'number' is not assignable to type 'Timeout'

* feat: add 'auto-fixed' prop to control whether to fixed the value that out of rang

* docs(Stepper): fix prop name

* perf: whether to format the value entered by the user
2022-09-28 22:02:32 +08:00
neverland
a1c859dc10 docs: fix website redirect (#11097) 2022-09-28 21:54:35 +08:00
neverland
f90a2f1611
docs(changelog): vant@4.0.0-rc.4 (#11088) 2022-09-25 16:06:47 +08:00
chenjiahan
6d2705f578 release: 4.0.0-rc.4 2022-09-25 16:04:32 +08:00
neverland
7e482c059b
fix(cli): downgrade vite version to fix the website (#11087) 2022-09-25 16:02:17 +08:00
neverland
2a66e7c9ea fix(Tabs): incorrect scroll position in some cases (#11085) 2022-09-24 23:00:19 +08:00
neverland
64af9ffd6f
chore(cli): bump esbuild@0.15 (#11084) 2022-09-24 20:38:27 +08:00
chenjiahan
0a75e92349 chore: fix build branch of website 2022-09-24 20:28:21 +08:00
chenjiahan
20310110e3 chore: fix github-pages-deploy-action version 2022-09-24 11:45:46 +08:00
chenjiahan
9ce2d0753f chore: fix duplicate branches 2022-09-24 11:43:45 +08:00
neverland
070431bef2
chore: update action for deploy website (#11083) 2022-09-24 11:42:31 +08:00
neverland
febb0a8a1b
release: @vant/cli 5.0.0-beta.0 (#11082) 2022-09-24 10:50:33 +08:00
Gavin
ece27f9474
feat(Field): add message param to 'end-validate' method (#11080) 2022-09-24 10:44:48 +08:00
neverland
0ceb6a843c
release: vant@1.4.3 (#11076) 2022-09-22 23:18:05 +08:00
neverland
980ab88c2e
perf: move @vant/icons to dev dependencies (#11075) 2022-09-22 23:08:51 +08:00
Gavin
e0063ae249
perf: improve the type of setTimeout (#11069)
* perf: improve the type of setTimeout with 'ReturnType<typeof setTimeout>'

* fix: fix type 'number' is not assignable to type 'Timeout'

Co-authored-by: wangjunwei <wangjunwei@nucarf.com>
2022-09-22 11:24:32 +08:00
neverland
ccd92a6eee fix(Tabs): incorrect scroll position when inited (#11059) 2022-09-18 22:06:59 +08:00
Reii
e250dd31b8
docs(PickerGroup): fix TimePicker link error (#11053) 2022-09-16 14:35:21 +08:00
Reii
282021de4e
docs(Cascader): update field-names type (#11052) 2022-09-16 13:01:22 +08:00
neverland
82883141a1
chore: rename main branch from dev to main (#11042) 2022-09-12 11:34:29 +08:00
neverland
a635e2d80b
docs: update links (#11041) 2022-09-12 11:27:14 +08:00
neverland
1d2e983a0f
docs: improve dark theme guide (#11040) 2022-09-12 11:16:11 +08:00
neverland
cbbdad909a
fix(cli): should remove light theme class in dark mode (#11039) 2022-09-12 11:05:44 +08:00
neverland
6a9d5515ce
docs(changelog): vant@4.0.0-rc.3 (#11038) 2022-09-12 10:54:15 +08:00
chenjiahan
5509ca0d1d release: 4.0.0-rc.3 2022-09-12 10:47:26 +08:00
neverland
65d9fbc5da
types: some theme vars can be number type (#11037) 2022-09-12 10:44:53 +08:00
neverland
39a100f3a0
feat: add themeVars type of all components (#11034)
* types: add types of all theme vars

* types: export all theme vars

* types: add ConfigProviderThemeVars

* fix: repeat key

* docs: add doc
2022-09-12 10:37:24 +08:00
neverland
e1670e27f6
types(Toast): fix missing global components type (#11033) 2022-09-11 23:00:05 +08:00
neverland
b29180933b
feat(Notify): add z-index prop (#11032) 2022-09-11 22:56:15 +08:00
neverland
97d02a1e92
docs: fix missing z-index prop in document (#11031) 2022-09-11 22:53:43 +08:00
chenjiahan
16c1f35135 release: @vant/popperjs 1.3.0 2022-09-11 16:49:56 +08:00
neverland
9cd60d151d
perf: remove popperjs to reduce install size (#11030) 2022-09-11 16:41:54 +08:00
neverland
ee6fa66e4a
docs(changelog): vant@4.0.0-rc.2 (#11029) 2022-09-11 12:08:32 +08:00
chenjiahan
bcae14d7cb release: 4.0.0-rc.2 2022-09-11 12:05:14 +08:00
neverland
4756168ae7
fix(Dialog): incorrect transform behavior (#11028) 2022-09-11 09:43:49 +08:00
neverland
fd9cf38022
style(Empty): fix opacity in dark mode (#11027) 2022-09-11 09:21:09 +08:00
neverland
34360abd3b
fix: attach css variables to :root element (#11026) 2022-09-11 09:11:53 +08:00
chenjiahan
b6f2eb3e2a docs: fix legacy css variables in demo 2022-09-10 22:43:56 +08:00
chenjiahan
845c0b720b chore: remove unused stylelint ignore 2022-09-10 22:07:20 +08:00
neverland
c243ebd1ff
docs(changelog): vant@4.0.0-rc.1 (#11025) 2022-09-10 22:06:33 +08:00
chenjiahan
09c2bd8efd release: 4.0.0-rc.1 2022-09-10 22:02:49 +08:00
neverland
8df6eaf5a0
Merge pull request #10208 from vant-ui/next
WIP: 4.0
2022-09-10 21:55:57 +08:00
chenjiahan
99833f2185 docs: switch dev branch to v4 2022-09-10 21:53:14 +08:00
326 changed files with 3315 additions and 1450 deletions

View File

@ -1,6 +1,6 @@
### Before submitting a pull request, please make sure the following is done: ### Before submitting a pull request, please make sure the following is done:
1. Read the [contributing guide](https://github.com/vant-ui/vant/blob/dev/.github/CONTRIBUTING.md). 1. Read the [contributing guide](https://github.com/vant-ui/vant/blob/main/.github/CONTRIBUTING.md).
2. If you've added code that should be tested, add tests. 2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation. 3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes (`npm test`). 4. Ensure the test suite passes (`npm test`).

View File

@ -13,10 +13,10 @@ name: "CodeQL"
on: on:
push: push:
branches: [ dev ] branches: [ main ]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [ dev ] branches: [ main ]
schedule: schedule:
- cron: '36 21 * * 2' - cron: '36 21 * * 2'

View File

@ -2,7 +2,7 @@ name: Deploy V4 Site
on: on:
push: push:
branches: [next] branches: [main]
paths: paths:
- 'packages/vant/docs/**' - 'packages/vant/docs/**'
@ -15,7 +15,7 @@ jobs:
- name: Checkout 🛎️ - name: Checkout 🛎️
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: 'next' ref: 'main'
- name: Install pnpm - name: Install pnpm
run: npm i pnpm@7 -g run: npm i pnpm@7 -g
@ -31,10 +31,18 @@ jobs:
- name: Build Site - name: Build Site
run: npm run build:site run: npm run build:site
- name: Deploy 🚀 - name: Deploy for Gitee 🚀
uses: JamesIves/github-pages-deploy-action@4.1.1 uses: JamesIves/github-pages-deploy-action@v4.4.0
with: with:
branch: gh-pages branch: gh-pages
folder: packages/vant/site-dist folder: packages/vant/site-dist
target-folder: v4 target-folder: v4
clean: false
- name: Deploy for GitHub 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.0
with:
branch: main
folder: packages/vant/site-dist
token: ${{ secrets.VANT_UI_TOKEN }}
repository-name: vant-ui/vant-ui.github.io
target-folder: vant/v4

View File

@ -2,7 +2,7 @@ name: Sync to Gitee
on: on:
push: push:
branches: [dev, 2.x, gh-pages] branches: [main, 2.x, 3.x, gh-pages]
workflow_dispatch: workflow_dispatch:

View File

@ -7,7 +7,7 @@ on:
pull_request: pull_request:
branches: branches:
- dev - main
workflow_dispatch: workflow_dispatch:

View File

@ -92,16 +92,15 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
| --- | --- | | --- | --- |
| [vant-weapp](https://github.com/vant-ui/vant-weapp) | WeChat MiniProgram UI | | [vant-weapp](https://github.com/vant-ui/vant-weapp) | WeChat MiniProgram UI |
| [vant-demo](https://github.com/vant-ui/vant-demo) | Collection of Vant demos | | [vant-demo](https://github.com/vant-ui/vant-demo) | Collection of Vant demos |
| [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | Scaffold for UI library | | [vant-cli](https://github.com/vant-ui/vant/tree/main/packages/vant-cli) | Scaffold for UI library |
| [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant icons | | [vant-icons](https://github.com/vant-ui/vant/tree/main/packages/vant-icons) | Vant icons |
| [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers | | [vant-touch-emulator](https://github.com/vant-ui/vant/tree/main/packages/vant-touch-emulator) | Using vant in desktop browsers |
## Community Ecosystem ## Community Ecosystem
| Project | Description | | Project | Description |
| --- | --- | | --- | --- |
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components based on Vant | | [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components based on Vant |
| [rc-ui-lib](https://github.com/rancui/rc-ui-lib) | React mobile UI Components based on Vant |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI | | [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro | | [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI | | [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI |
@ -112,7 +111,7 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
- [Documentation](https://vant-ui.github.io/vant) - [Documentation](https://vant-ui.github.io/vant)
- [Changelog](https://vant-ui.github.io/vant#/en-US/changelog) - [Changelog](https://vant-ui.github.io/vant#/en-US/changelog)
- [Gitter](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link) - [Discussions](https://github.com/vant-ui/vant/discussions)
## Preview ## Preview

View File

@ -98,9 +98,9 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
| --- | --- | | --- | --- |
| [vant-weapp](https://github.com/vant-ui/vant-weapp) | Vant 微信小程序版 | | [vant-weapp](https://github.com/vant-ui/vant-weapp) | Vant 微信小程序版 |
| [vant-demo](https://github.com/vant-ui/vant-demo) | Vant 官方示例合集 | | [vant-demo](https://github.com/vant-ui/vant-demo) | Vant 官方示例合集 |
| [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | 开箱即用的组件库搭建工具 | | [vant-cli](https://github.com/vant-ui/vant/tree/main/packages/vant-cli) | 开箱即用的组件库搭建工具 |
| [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant 图标库 | | [vant-icons](https://github.com/vant-ui/vant/tree/main/packages/vant-icons) | Vant 图标库 |
| [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | 在桌面端使用 Vant 的辅助库 | | [vant-touch-emulator](https://github.com/vant-ui/vant/tree/main/packages/vant-touch-emulator) | 在桌面端使用 Vant 的辅助库 |
## 社区生态 ## 社区生态
@ -109,7 +109,6 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
| 项目 | 描述 | | 项目 | 描述 |
| --- | --- | | --- | --- |
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 框架移动端组件库 | | [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 框架移动端组件库 |
| [rc-ui-lib](https://github.com/rancui/rc-ui-lib) | 参照 Vant 打造的 React 框架移动端组件库 |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 | | [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 | | [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 | | [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 |
@ -120,7 +119,8 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
- [详细文档](https://vant-contrib.gitee.io/vant) - [详细文档](https://vant-contrib.gitee.io/vant)
- [更新日志](https://vant-contrib.gitee.io/vant#/zh-CN/changelog) - [更新日志](https://vant-contrib.gitee.io/vant#/zh-CN/changelog)
- [Gitter 讨论组](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link) - [码云镜像仓库](https://gitee.com/vant-contrib/vant)
- [Discussions 讨论区](https://github.com/vant-ui/vant/discussions)
## 手机预览 ## 手机预览

View File

@ -31,7 +31,7 @@
"vue": "^3.0.0" "vue": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@vant/cli": "^4.0.0", "@vant/cli": "^5.0.0",
"vue": "^3.0.0", "vue": "^3.0.0",
"sass": "^1.49.7" "sass": "^1.49.7"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "create-vant-cli-app", "name": "create-vant-cli-app",
"version": "2.0.1", "version": "2.1.0",
"description": "Create Vant CLI App", "description": "Create Vant CLI App",
"main": "lib/index.js", "main": "lib/index.js",
"bin": { "bin": {

View File

@ -36,7 +36,7 @@
"author": "chenjiahan", "author": "chenjiahan",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"esbuild": "^0.14.54", "esbuild": "^0.15.9",
"release-it": "^15.4.1", "release-it": "^15.4.1",
"typescript": "^4.8.2" "typescript": "^4.8.2"
}, },

View File

@ -65,7 +65,7 @@ Please add the followed config to `package.json` file.
## More Details ## More Details
- [cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/commands.md) - [cli](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/commands.md)
- [config](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/config.md) - [config](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/config.md)
- [directory structure](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.md) - [directory structure](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/directory.md)
- [CHANGELOG](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/changelog.md) - [CHANGELOG](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/changelog.md)

View File

@ -62,7 +62,7 @@ pnpm add @vant/cli -D
## 详细文档 ## 详细文档
- [命令](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/commands.zh-CN.md) - [命令](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/commands.zh-CN.md)
- [配置指南](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/config.zh-CN.md) - [配置指南](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/config.zh-CN.md)
- [目录结构](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.zh-CN.md) - [目录结构](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/directory.zh-CN.md)
- [更新日志](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/changelog.md) - [更新日志](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/changelog.md)

View File

@ -1,14 +1,29 @@
# 更新日志 # 更新日志
## v5.0.0 (未发布) ## v5.0.2
`2022-10-07`
- 修复首次运行 dev 时 vite 引入了两份 Vue 代码导致渲染失败的问题
## v5.0.1
`2022-10-06`
- 修复 jest 版本未正确升级的问题
## v5.0.0
### 依赖升级 ### 依赖升级
`2022-10-06`
对以下依赖进行了大版本升级: 对以下依赖进行了大版本升级:
- vite v3 - vite: 由 v2 升级至 v3
- @vitejs/plugin-vue v3 - jest: 由 v27 升级至 v29
- @vitejs/plugin-vue-jsx v2 - @vitejs/plugin-vue: 由 v2 升级至 v3
- @vitejs/plugin-vue-jsx: 由 v1 升级至 v2
### 依赖精简 ### 依赖精简

View File

@ -29,6 +29,10 @@ const DEFAULT_CONFIG = {
], ],
coverageReporters: ['html', 'lcov', 'text-summary'], coverageReporters: ['html', 'lcov', 'text-summary'],
coverageDirectory: './test/coverage', coverageDirectory: './test/coverage',
testEnvironmentOptions: {
// https://stackoverflow.com/questions/72428323/jest-referenceerror-vue-is-not-defined
customExportConditions: ['node', 'node-addons'],
},
}; };
function readRootConfig() { function readRootConfig() {

View File

@ -87,6 +87,8 @@ module.exports = {
if (isJsxFile(path)) { if (isJsxFile(path)) {
code = transformJsx(code, path); code = transformJsx(code, path);
} }
return transformScript(code); return {
code: transformScript(code)
};
}, },
}; };

View File

@ -29,7 +29,7 @@ Start local dev server for browsering components and demo.
Build Vue component library. Build Vue component library.
Files will be output to `es` and `lib` directory. More details [directory structure](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.md) Files will be output to `es` and `lib` directory. More details [directory structure](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/directory.md)
Please add the followed config to `package.json` when publish to npm. Please add the followed config to `package.json` when publish to npm.

View File

@ -31,7 +31,7 @@ npx vant-cli dev
构建组件库。 构建组件库。
运行 build 命令会在 `es``lib` 目录下生成可用于生产环境的组件代码,详见 [目录结构](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.zh-CN.md)。 运行 build 命令会在 `es``lib` 目录下生成可用于生产环境的组件代码,详见 [目录结构](https://github.com/vant-ui/vant/tree/main/packages/vant-cli/docs/directory.zh-CN.md)。
发布 npm 时,请将以下配置加入到 `package.json` 中,使 npm 包能被正确识别: 发布 npm 时,请将以下配置加入到 `package.json` 中,使 npm 包能被正确识别:

View File

@ -1,6 +1,6 @@
{ {
"name": "@vant/cli", "name": "@vant/cli",
"version": "4.0.4", "version": "5.0.2",
"type": "module", "type": "module",
"main": "lib/index.js", "main": "lib/index.js",
"typings": "lib/index.d.ts", "typings": "lib/index.d.ts",
@ -39,7 +39,7 @@
"author": "chenjiahan", "author": "chenjiahan",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@jest/types": "^27.5.1", "@jest/types": "^29.1.2",
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^9.0.13",
"@types/less": "^3.0.3", "@types/less": "^3.0.3",
"@types/markdown-it": "^12.2.3", "@types/markdown-it": "^12.2.3",
@ -52,7 +52,7 @@
"@babel/preset-typescript": "^7.18.6", "@babel/preset-typescript": "^7.18.6",
"@docsearch/css": "^3.2.1", "@docsearch/css": "^3.2.1",
"@docsearch/js": "^3.2.1", "@docsearch/js": "^3.2.1",
"@types/jest": "^27.5.2", "@types/jest": "^29.1.1",
"@vant/eslint-config": "^3.5.0", "@vant/eslint-config": "^3.5.0",
"@vant/touch-emulator": "^1.4.0", "@vant/touch-emulator": "^1.4.0",
"@vitejs/plugin-vue": "^3.0.3", "@vitejs/plugin-vue": "^3.0.3",
@ -62,7 +62,7 @@
"commander": "^9.4.0", "commander": "^9.4.0",
"consola": "^2.15.3", "consola": "^2.15.3",
"conventional-changelog": "^3.1.25", "conventional-changelog": "^3.1.25",
"esbuild": "^0.14.54", "esbuild": "^0.15.9",
"eslint": "^8.23.0", "eslint": "^8.23.0",
"execa": "^5.1.1", "execa": "^5.1.1",
"fast-glob": "^3.2.11", "fast-glob": "^3.2.11",
@ -70,9 +70,10 @@
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"highlight.js": "^11.6.0", "highlight.js": "^11.6.0",
"husky": "^8.0.1", "husky": "^8.0.1",
"jest": "^27.5.1", "jest": "^29.1.2",
"jest-canvas-mock": "^2.4.0", "jest-canvas-mock": "^2.4.0",
"jest-serializer-html": "^7.1.0", "jest-serializer-html": "^7.1.0",
"jest-environment-jsdom": "^29.1.2",
"less": "^4.1.3", "less": "^4.1.3",
"markdown-it": "^12.3.2", "markdown-it": "^12.3.2",
"markdown-it-anchor": "^8.6.4", "markdown-it-anchor": "^8.6.4",
@ -85,7 +86,7 @@
"release-it": "^15.4.1", "release-it": "^15.4.1",
"transliteration": "^2.3.5", "transliteration": "^2.3.5",
"typescript": "^4.8.2", "typescript": "^4.8.2",
"vite": "^3.0.9", "vite": "3.0.9",
"vite-plugin-html": "^2.1.2", "vite-plugin-html": "^2.1.2",
"vite-plugin-md": "^0.11.9", "vite-plugin-md": "^0.11.9",
"vue-router": "^4.1.5" "vue-router": "^4.1.5"

View File

@ -1,4 +1,4 @@
body { :root {
// colors // colors
--van-doc-black: #000; --van-doc-black: #000;
--van-doc-white: #fff; --van-doc-white: #fff;

View File

@ -138,8 +138,8 @@ export default {
currentTheme: { currentTheme: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
window.localStorage.setItem('vantTheme', newVal); window.localStorage.setItem('vantTheme', newVal);
document.body.classList.remove(`van-doc-theme-${oldVal}`); document.documentElement.classList.remove(`van-doc-theme-${oldVal}`);
document.body.classList.add(`van-doc-theme-${newVal}`); document.documentElement.classList.add(`van-doc-theme-${newVal}`);
syncThemeToChild(newVal); syncThemeToChild(newVal);
}, },
immediate: true, immediate: true,

View File

@ -24,12 +24,21 @@ export default {
watch( watch(
theme, theme,
(newVal, oldVal) => { (newVal, oldVal) => {
document.body.classList.remove(`van-doc-theme-${oldVal}`); document.documentElement.classList.remove(`van-doc-theme-${oldVal}`);
document.body.classList.add(`van-doc-theme-${newVal}`); document.documentElement.classList.add(`van-doc-theme-${newVal}`);
const { darkModeClass } = config.site; const { darkModeClass, lightModeClass } = config.site;
if (darkModeClass) { if (darkModeClass) {
document.body.classList.toggle(darkModeClass, newVal === 'dark'); document.documentElement.classList.toggle(
darkModeClass,
newVal === 'dark'
);
}
if (lightModeClass) {
document.documentElement.classList.toggle(
lightModeClass,
newVal === 'light'
);
} }
}, },
{ immediate: true } { immediate: true }
@ -43,6 +52,7 @@ export default {
body { body {
min-width: 100vw; min-width: 100vw;
background-color: inherit;
} }
.van-doc-theme-light { .van-doc-theme-light {

View File

@ -1,12 +1,7 @@
import glob from 'fast-glob'; import glob from 'fast-glob';
import { join, parse } from 'path'; import { join, parse } from 'path';
import { existsSync, readFileSync, readdirSync } from 'fs'; import { existsSync, readFileSync, readdirSync } from 'fs';
import { import { pascalize, getVantConfig, normalizePath } from '../common/index.js';
isDev,
pascalize,
getVantConfig,
normalizePath,
} from '../common/index.js';
import { import {
SRC_DIR, SRC_DIR,
DOCS_DIR, DOCS_DIR,
@ -80,10 +75,7 @@ function genImportDocuments(items: DocumentItem[]) {
return items return items
.map((item) => { .map((item) => {
const path = normalizePath(item.path); const path = normalizePath(item.path);
if (isDev()) {
return `const ${item.name} = () => import('${path}');`; return `const ${item.name} = () => import('${path}');`;
}
return `import ${item.name} from '${path}';`;
}) })
.join('\n'); .join('\n');
} }

View File

@ -144,6 +144,11 @@ export function getViteConfigForSiteDev(): InlineConfig {
return { return {
root: SITE_SRC_DIR, root: SITE_SRC_DIR,
optimizeDeps: {
// https://github.com/youzan/vant/issues/10930
include: ['vue', 'vue-router'],
},
plugins: [ plugins: [
vitePluginGenVantBaseCode(), vitePluginGenVantBaseCode(),
vitePluginVue({ vitePluginVue({

View File

@ -39,7 +39,7 @@
"@vue/runtime-core": "^3.2.27", "@vue/runtime-core": "^3.2.27",
"vant": "workspace:*", "vant": "workspace:*",
"vue": "^3.2.27", "vue": "^3.2.27",
"esbuild": "^0.14.29", "esbuild": "^0.15.9",
"release-it": "^15.1.1", "release-it": "^15.1.1",
"typescript": "^4.7.4" "typescript": "^4.7.4"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "@vant/popperjs", "name": "@vant/popperjs",
"version": "1.2.1", "version": "1.3.0",
"description": "Pre-compiled popperjs core", "description": "Pre-compiled popperjs core",
"main": "dist/index.cjs.js", "main": "dist/index.cjs.js",
"module": "dist/index.esm.mjs", "module": "dist/index.esm.mjs",
@ -36,11 +36,9 @@
"bugs": "https://github.com/vant-ui/vant/issues", "bugs": "https://github.com/vant-ui/vant/issues",
"author": "chenjiahan", "author": "chenjiahan",
"license": "MIT", "license": "MIT",
"dependencies": {
"@popperjs/core": "^2.11.6"
},
"devDependencies": { "devDependencies": {
"esbuild": "^0.14.54", "@popperjs/core": "^2.11.6",
"esbuild": "^0.15.9",
"release-it": "^15.4.1", "release-it": "^15.4.1",
"typescript": "^4.8.2" "typescript": "^4.8.2"
}, },

View File

@ -1,6 +1,6 @@
import { createPopper } from '@popperjs/core/lib/popper-lite'; import { createPopper } from '@popperjs/core/lib/popper-lite';
import offsetModifier from '@popperjs/core/lib/modifiers/offset'; import offsetModifier from '@popperjs/core/lib/modifiers/offset';
import type { Instance, Placement } from '@popperjs/core'; import type { Instance } from '@popperjs/core';
export { createPopper, offsetModifier }; export { createPopper, offsetModifier };
export type { Instance, Placement }; export type { Instance };

View File

@ -1,5 +1,13 @@
# Changelog # Changelog
## v1.4.3
- improve `useEventListener` typing
## v1.4.2
- `useClickAway` support multiple targets
## v1.4.1 ## v1.4.1
- Add `exports` field to package.json, support nuxt 3. - Add `exports` field to package.json, support nuxt 3.

View File

@ -1,6 +1,6 @@
{ {
"name": "@vant/use", "name": "@vant/use",
"version": "1.4.2", "version": "1.4.3",
"description": "Vant Composition API", "description": "Vant Composition API",
"main": "dist/index.cjs.js", "main": "dist/index.cjs.js",
"module": "dist/index.esm.mjs", "module": "dist/index.esm.mjs",
@ -37,7 +37,7 @@
"author": "chenjiahan", "author": "chenjiahan",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"esbuild": "^0.14.54", "esbuild": "^0.15.9",
"release-it": "^15.4.1", "release-it": "^15.4.1",
"typescript": "^4.8.2", "typescript": "^4.8.2",
"vue": "^3.2.38" "vue": "^3.2.38"

View File

@ -1,4 +0,0 @@
node_modules
dist
lib
*.tsx

View File

@ -132,7 +132,7 @@ module.exports = {
### Adapt to PC Browsers ### Adapt to PC Browsers
Vant is a mobile-first component library, if you want to use Vant in PC browsers, you can use the [@vant/touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) module. This module will automatically convert the mouse events of the PC browser into the touch events of the mobile browser. Vant is a mobile-first component library, if you want to use Vant in PC browsers, you can use the [@vant/touch-emulator](https://github.com/vant-ui/vant/tree/main/packages/vant-touch-emulator) module. This module will automatically convert the mouse events of the PC browser into the touch events of the mobile browser.
```bash ```bash
# Install # Install

View File

@ -197,7 +197,7 @@ module.exports = {
Vant 是一个面向移动端的组件库,因此默认只适配了移动端设备,这意味着组件只监听了移动端的 `touch` 事件,没有监听桌面端的 `mouse` 事件。 Vant 是一个面向移动端的组件库,因此默认只适配了移动端设备,这意味着组件只监听了移动端的 `touch` 事件,没有监听桌面端的 `mouse` 事件。
如果你需要在桌面端使用 Vant可以引入我们提供的 [@vant/touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator),这个库会在桌面端自动将 `mouse` 事件转换成对应的 `touch` 事件,使得组件能够在桌面端使用。 如果你需要在桌面端使用 Vant可以引入我们提供的 [@vant/touch-emulator](https://github.com/vant-ui/vant/tree/main/packages/vant-touch-emulator),这个库会在桌面端自动将 `mouse` 事件转换成对应的 `touch` 事件,使得组件能够在桌面端使用。
```bash ```bash
# 安装模块 # 安装模块

View File

@ -19,6 +19,62 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details ## Details
### [v4.0.0-rc.4](https://github.com/vant-ui/vant/compare/v4.0.0-rc.3...v4.0.0-rc.4)
`2022-09-25`
**Feature**
- Field: add message param to 'end-validate' method [#11080](https://github.com/vant-ui/vant/issues/11080)
**Bug Fixes**
- Tabs: incorrect scroll position in some cases [#11085](https://github.com/vant-ui/vant/issues/11085)
- Tabs: incorrect scroll position when inited [#11059](https://github.com/vant-ui/vant/issues/11059)
### [v4.0.0-rc.3](https://github.com/vant-ui/vant/compare/v4.0.0-rc.2...v4.0.0-rc.3)
`2022-09-12`
**Feature**
- ConfigProvider: add ConfigProviderThemeVars type [#11034](https://github.com/vant-ui/vant/issues/11034)
- Notify: add z-index prop [#11032](https://github.com/vant-ui/vant/issues/11032)
- remove popperjs to reduce install size [#11030](https://github.com/vant-ui/vant/issues/11030)
**Types**
- Toast: fix missing global components type [#11033](https://github.com/vant-ui/vant/issues/11033)
### [v4.0.0-rc.2](https://github.com/vant-ui/vant/compare/v4.0.0-rc.1...v4.0.0-rc.2)
`2022-09-11`
**Breaking Changes**
- attach css variables to :root element [#11026](https://github.com/vant-ui/vant/issues/11026)
**Bug Fixes**
- Dialog: incorrect transform behavior [#11028](https://github.com/vant-ui/vant/issues/11028)
- Empty: fix opacity in dark mode [#11027](https://github.com/vant-ui/vant/issues/11027)
### [v4.0.0-rc.1](https://github.com/vant-ui/vant/compare/v4.0.0-rc.0...v4.0.0-rc.1)
`2022-09-10`
**Feature**
- export props of all components [#11024](https://github.com/vant-ui/vant/issues/11024)
- Dialog: message-align can be justify [#11014](https://github.com/vant-ui/vant/issues/11014)
- Image: add block prop [#11022](https://github.com/vant-ui/vant/issues/11022)
- Toast: add message slot [#11018](https://github.com/vant-ui/vant/issues/11018)
**Bug Fixes**
- Picker: failed to update value in some cases [#11009](https://github.com/vant-ui/vant/issues/11009)
- Locale: avoid getting unexpected value [#11010](https://github.com/vant-ui/vant/issues/11010)
### [v4.0.0-rc.0](https://github.com/vant-ui/vant/compare/v3.6.2...v4.0.0-rc.0) ### [v4.0.0-rc.0](https://github.com/vant-ui/vant/compare/v3.6.2...v4.0.0-rc.0)
`2022-09-04` `2022-09-04`

View File

@ -19,6 +19,62 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
## 更新内容 ## 更新内容
### [v4.0.0-rc.4](https://github.com/vant-ui/vant/compare/v4.0.0-rc.3...v4.0.0-rc.4)
`2022-09-25`
**Feature**
- Field: end-validate 事件新增 message 参数 [#11080](https://github.com/vant-ui/vant/issues/11080)
**Bug Fixes**
- Tabs: 修复个别情况下页面滚动位置错误的问题 [#11085](https://github.com/vant-ui/vant/issues/11085)
- Tabs: 修复初始化时菜单横向滚动位置错误的问题 [#11059](https://github.com/vant-ui/vant/issues/11059)
### [v4.0.0-rc.3](https://github.com/vant-ui/vant/compare/v4.0.0-rc.2...v4.0.0-rc.3)
`2022-09-12`
**Feature**
- ConfigProvider: 新增 ConfigProviderThemeVars 类型 [#11034](https://github.com/vant-ui/vant/issues/11034)
- Notify: 新增 z-index 属性 [#11032](https://github.com/vant-ui/vant/issues/11032)
- 移除 `@popperjs/core` 依赖,减少安装体积 1.6MB [#11030](https://github.com/vant-ui/vant/issues/11030)
**Types**
- Toast: 修复缺少全局类型定义的问题 [#11033](https://github.com/vant-ui/vant/issues/11033)
### [v4.0.0-rc.2](https://github.com/vant-ui/vant/compare/v4.0.0-rc.1...v4.0.0-rc.2)
`2022-09-11`
**Breaking Changes**
- 调整了所有 CSS 变量的挂载位置,由 `body` 节点调整回 `:root` 节点,调整后与 Vant v3 版本保持一致,以便于 v3 项目更平滑地升级到 v4 版本。 [#11026](https://github.com/vant-ui/vant/issues/11026)
**Bug Fixes**
- Dialog: 修复过渡动画异常的问题 [#11028](https://github.com/vant-ui/vant/issues/11028)
- Empty: 修复深色模式下亮度过高的问题 [#11027](https://github.com/vant-ui/vant/issues/11027)
### [v4.0.0-rc.1](https://github.com/vant-ui/vant/compare/v4.0.0-rc.0...v4.0.0-rc.1)
`2022-09-10`
**Feature**
- 导出所有组件的 props方便进行二次封装 [#11024](https://github.com/vant-ui/vant/issues/11024)
- Dialog: message-align 属性支持设置为 justify [#11014](https://github.com/vant-ui/vant/issues/11014)
- Image: 新增 block 属性 [#11022](https://github.com/vant-ui/vant/issues/11022)
- Toast: 新增 message 插槽 [#11018](https://github.com/vant-ui/vant/issues/11018)
**Bug Fixes**
- Picker: 修复部分情况下未正确更新选中值的问题 [#11009](https://github.com/vant-ui/vant/issues/11009)
- Locale: 修复读取 i18n 文案时可能获取到 JS 原生方法的问题 [#11010](https://github.com/vant-ui/vant/issues/11010)
### [v4.0.0-rc.0](https://github.com/vant-ui/vant/compare/v3.6.2...v4.0.0-rc.0) ### [v4.0.0-rc.0](https://github.com/vant-ui/vant/compare/v3.6.2...v4.0.0-rc.0)
`2022-09-04` `2022-09-04`

View File

@ -38,9 +38,9 @@ pnpm dev
仓库的不同分支对应不同的 Vant 版本,请切换到对应分支进行开发: 仓库的不同分支对应不同的 Vant 版本,请切换到对应分支进行开发:
- dev 分支对应 Vant 4 版本,适用于 Vue 3
- 3.x 分支对应 Vant 3 版本 ,适用于 Vue 3
- 2.x 分支对应 Vant 2 版本,适用于 Vue 2 - 2.x 分支对应 Vant 2 版本,适用于 Vue 2
- dev 分支对应 Vant 3 版本 ,适用于 Vue 3
- next 分支对应 Vant 4 版本,适用于 Vue 3
### 镜像仓库 ### 镜像仓库

View File

@ -22,7 +22,7 @@ Contains color specifications, font specifications, and component design specifi
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/tab_202009101415.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)"> <img src="https://fastly.jsdelivr.net/npm/@vant/assets/tab_202009101415.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)">
<a class="design-download" href="https://github.com/vant-ui/vant/blob/dev/packages/vant/docs/assets/design.sketch?raw=true">Download</a> <a class="design-download" href="https://github.com/vant-ui/vant/blob/main/packages/vant/docs/assets/design.sketch?raw=true">Download</a>
### Icons (Sketch) ### Icons (Sketch)
@ -30,7 +30,7 @@ Contains icon library resources.
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/design-icons-0321.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)"> <img src="https://fastly.jsdelivr.net/npm/@vant/assets/design-icons-0321.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)">
<a class="design-download" href="https://github.com/vant-ui/vant/blob/dev/packages/vant-icons/assets/icons.sketch?raw=true">Download</a> <a class="design-download" href="https://github.com/vant-ui/vant/blob/main/packages/vant-icons/assets/icons.sketch?raw=true">Download</a>
### Axure ### Axure

View File

@ -22,7 +22,7 @@
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/tab_202009101415.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)"> <img src="https://fastly.jsdelivr.net/npm/@vant/assets/tab_202009101415.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)">
<a class="design-download" href="https://github.com/vant-ui/vant/blob/dev/packages/vant/docs/assets/design.sketch?raw=true">下载</a> <a class="design-download" href="https://github.com/vant-ui/vant/blob/main/packages/vant/docs/assets/design.sketch?raw=true">下载</a>
### 图标设计稿Sketch ### 图标设计稿Sketch
@ -30,7 +30,7 @@
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/design-icons-0321.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)"> <img src="https://fastly.jsdelivr.net/npm/@vant/assets/design-icons-0321.png" style="width: 80%; box-shadow: 0 1px 2px rgba(0,0,0,.2)">
<a class="design-download" href="https://github.com/vant-ui/vant/blob/dev/packages/vant-icons/assets/icons.sketch?raw=true">下载</a> <a class="design-download" href="https://github.com/vant-ui/vant/blob/main/packages/vant-icons/assets/icons.sketch?raw=true">下载</a>
#### 在线资源 #### 在线资源

View File

@ -68,6 +68,12 @@ Select 是桌面端常用的组件,但它的交互形式不适合移动端。
在移动端,我们推荐使用 [Picker 选择器组件](#/zh-CN/picker) 作为代替。 在移动端,我们推荐使用 [Picker 选择器组件](#/zh-CN/picker) 作为代替。
### 是否支持在 uni-app 中使用?
Vant 所有组件都是基于 Vue 框架实现的,没有针对 uni-app 进行适配,因此不保证各个组件在 uni-app 下的可用性。
如果你在 uni-app 中使用 Vant 遇到问题,建议向 uni-app 进行反馈。
### 部分组件无法在桌面端进行操作? ### 部分组件无法在桌面端进行操作?
参见[桌面端适配](#/zh-CN/advanced-usage#zhuo-mian-duan-gua-pei)。 参见[桌面端适配](#/zh-CN/advanced-usage#zhuo-mian-duan-gua-pei)。

View File

@ -41,16 +41,15 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
| --- | --- | | --- | --- |
| [vant-weapp](https://github.com/vant-ui/vant-weapp) | WeChat MiniProgram UI | | [vant-weapp](https://github.com/vant-ui/vant-weapp) | WeChat MiniProgram UI |
| [vant-demo](https://github.com/vant-ui/vant-demo) | Collection of Vant demos | | [vant-demo](https://github.com/vant-ui/vant-demo) | Collection of Vant demos |
| [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | Scaffold for UI library | | [vant-cli](https://github.com/vant-ui/vant/tree/main/packages/vant-cli) | Scaffold for UI library |
| [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant icons | | [vant-icons](https://github.com/vant-ui/vant/tree/main/packages/vant-icons) | Vant icons |
| [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers | | [vant-touch-emulator](https://github.com/vant-ui/vant/tree/main/packages/vant-touch-emulator) | Using vant in desktop browsers |
### Community Ecosystem ### Community Ecosystem
| Project | Description | | Project | Description |
| --- | --- | | --- | --- |
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components based on Vant | | [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components based on Vant |
| [rc-ui-lib](https://github.com/rancui/rc-ui-lib) | React Mobile UI Components Library |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI | | [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro | | [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI | | [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI |
@ -61,7 +60,7 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
- [Feedback](https://github.com/vant-ui/vant/issues) - [Feedback](https://github.com/vant-ui/vant/issues)
- [Changelog](#/en-US/changelog) - [Changelog](#/en-US/changelog)
- [Gitter](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link) - [Discussions](https://github.com/vant-ui/vant/discussions)
## Contribution ## Contribution
@ -83,7 +82,7 @@ Thanks to the following friends for their contributions to Vant:
### Contribution Guide ### Contribution Guide
Please make sure to read the [Contributing Guide](https://github.com/vant-ui/vant/blob/dev/.github/CONTRIBUTING.md) before making a pull request. Please make sure to read the [Contributing Guide](https://github.com/vant-ui/vant/blob/main/.github/CONTRIBUTING.md) before making a pull request.
### LICENSE ### LICENSE

View File

@ -53,9 +53,9 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
| --- | --- | | --- | --- |
| [vant-weapp](https://github.com/vant-ui/vant-weapp) | Vant 微信小程序版 | | [vant-weapp](https://github.com/vant-ui/vant-weapp) | Vant 微信小程序版 |
| [vant-demo](https://github.com/vant-ui/vant-demo) | Vant 官方示例合集 | | [vant-demo](https://github.com/vant-ui/vant-demo) | Vant 官方示例合集 |
| [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | 开箱即用的组件库搭建工具 | | [vant-cli](https://github.com/vant-ui/vant/tree/main/packages/vant-cli) | 开箱即用的组件库搭建工具 |
| [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant 图标库 | | [vant-icons](https://github.com/vant-ui/vant/tree/main/packages/vant-icons) | Vant 图标库 |
| [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | 在桌面端使用 Vant 的辅助库 | | [vant-touch-emulator](https://github.com/vant-ui/vant/tree/main/packages/vant-touch-emulator) | 在桌面端使用 Vant 的辅助库 |
### 社区生态 ### 社区生态
@ -64,7 +64,6 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
| 项目 | 描述 | | 项目 | 描述 |
| --- | --- | | --- | --- |
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 移动端组件库 | | [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 移动端组件库 |
| [rc-ui-lib](https://github.com/rancui/rc-ui-lib) | 基于 Vant 的 React 版本移动端 UI 组件库 |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 | | [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 | | [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 | | [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 |
@ -75,8 +74,8 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
- [意见反馈](https://github.com/vant-ui/vant/issues) - [意见反馈](https://github.com/vant-ui/vant/issues)
- [更新日志](#/zh-CN/changelog) - [更新日志](#/zh-CN/changelog)
- [码云镜像](https://gitee.com/vant-contrib/vant) - [码云镜像仓库](https://gitee.com/vant-contrib/vant)
- [Gitter 讨论组](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link) - [Discussions 讨论区](https://github.com/vant-ui/vant/discussions)
## 贡献 ## 贡献

View File

@ -1,6 +1,6 @@
{ {
"name": "vant", "name": "vant",
"version": "4.0.0-rc.0", "version": "4.0.0-rc.5",
"description": "Mobile UI Components built on Vue", "description": "Mobile UI Components built on Vue",
"main": "lib/vant.cjs.js", "main": "lib/vant.cjs.js",
"module": "es/index.mjs", "module": "es/index.mjs",
@ -47,19 +47,19 @@
"components" "components"
], ],
"dependencies": { "dependencies": {
"@vant/icons": "^1.8.0", "@vant/popperjs": "^1.3.0",
"@vant/popperjs": "^1.2.1", "@vant/use": "^1.4.3"
"@vant/use": "^1.4.2"
}, },
"peerDependencies": { "peerDependencies": {
"vue": "^3.0.0" "vue": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^16.11.56", "@types/node": "^16.11.56",
"@types/jest": "^27.0.0", "@types/jest": "^29.1.1",
"@vant/area-data": "workspace:*", "@vant/area-data": "workspace:*",
"@vant/cli": "workspace:*", "@vant/cli": "workspace:*",
"@vant/eslint-config": "workspace:*", "@vant/eslint-config": "workspace:*",
"@vant/icons": "workspace:*",
"@vue/runtime-core": "^3.2.38", "@vue/runtime-core": "^3.2.38",
"@vue/test-utils": "^2.0.2", "@vue/test-utils": "^2.0.2",
"typescript": "^4.8.2", "typescript": "^4.8.2",

View File

@ -1,4 +1,4 @@
body { :root {
--van-action-bar-button-height: 40px; --van-action-bar-button-height: 40px;
--van-action-bar-button-warning-color: var(--van-gradient-orange); --van-action-bar-button-warning-color: var(--van-gradient-orange);
--van-action-bar-button-danger-color: var(--van-gradient-red); --van-action-bar-button-danger-color: var(--van-gradient-red);

View File

@ -5,6 +5,7 @@ export const ActionBarButton = withInstall(_ActionBarButton);
export default ActionBarButton; export default ActionBarButton;
export { actionBarButtonProps } from './ActionBarButton'; export { actionBarButtonProps } from './ActionBarButton';
export type { ActionBarButtonProps } from './ActionBarButton'; export type { ActionBarButtonProps } from './ActionBarButton';
export type { ActionBarButtonThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,5 @@
export type ActionBarButtonThemeVars = {
actionBarButtonHeight?: string;
actionBarButtonWarningColor?: string;
actionBarButtonDangerColor?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-action-bar-icon-width: 48px; --van-action-bar-icon-width: 48px;
--van-action-bar-icon-height: 100%; --van-action-bar-icon-height: 100%;
--van-action-bar-icon-color: var(--van-text-color); --van-action-bar-icon-color: var(--van-text-color);

View File

@ -5,6 +5,7 @@ export const ActionBarIcon = withInstall(_ActionBarIcon);
export default ActionBarIcon; export default ActionBarIcon;
export { actionBarIconProps } from './ActionBarIcon'; export { actionBarIconProps } from './ActionBarIcon';
export type { ActionBarIconProps } from './ActionBarIcon'; export type { ActionBarIconProps } from './ActionBarIcon';
export type { ActionBarIconThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,10 @@
export type ActionBarIconThemeVars = {
actionBarIconWidth?: string;
actionBarIconHeight?: string;
actionBarIconColor?: string;
actionBarIconSize?: string;
actionBarIconFontSize?: string;
actionBarIconActiveColor?: string;
actionBarIconTextColor?: string;
actionBarIconBackground?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-action-bar-background: var(--van-background-2); --van-action-bar-background: var(--van-background-2);
--van-action-bar-height: 50px; --van-action-bar-height: 50px;
} }

View File

@ -5,6 +5,7 @@ export const ActionBar = withInstall(_ActionBar);
export default ActionBar; export default ActionBar;
export { actionBarProps } from './ActionBar'; export { actionBarProps } from './ActionBar';
export type { ActionBarProps } from './ActionBar'; export type { ActionBarProps } from './ActionBar';
export type { ActionBarThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,4 @@
export type ActionBarThemeVars = {
actionBarBackground?: string;
actionBarHeight?: string;
};

View File

@ -179,6 +179,7 @@ export default {
| closeable | Whether to show close icon | _boolean_ | `true` | | closeable | Whether to show close icon | _boolean_ | `true` |
| close-icon | Close icon name | _string_ | `cross` | | close-icon | Close icon name | _string_ | `cross` |
| duration | Transition duration, unit second | _number \| string_ | `0.3` | | duration | Transition duration, unit second | _number \| string_ | `0.3` |
| z-index | Set the z-index to a fixed value | _number \| string_ | `2000+` |
| round | Whether to show round corner | _boolean_ | `true` | | round | Whether to show round corner | _boolean_ | `true` |
| overlay | Whether to show overlay | _boolean_ | `true` | | overlay | Whether to show overlay | _boolean_ | `true` |
| overlay-class | Custom overlay class | _string \| Array \| object_ | - | | overlay-class | Custom overlay class | _string \| Array \| object_ | - |

View File

@ -189,6 +189,7 @@ export default {
| closeable | 是否显示关闭图标 | _boolean_ | `true` | | closeable | 是否显示关闭图标 | _boolean_ | `true` |
| close-icon | 关闭图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ | `cross` | | close-icon | 关闭图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ | `cross` |
| duration | 动画时长,单位秒,设置为 0 可以禁用动画 | _number \| string_ | `0.3` | | duration | 动画时长,单位秒,设置为 0 可以禁用动画 | _number \| string_ | `0.3` |
| z-index | 将面板的 z-index 层级设置为一个固定值 | _number \| string_ | `2000+` |
| round | 是否显示圆角 | _boolean_ | `true` | | round | 是否显示圆角 | _boolean_ | `true` |
| overlay | 是否显示遮罩层 | _boolean_ | `true` | | overlay | 是否显示遮罩层 | _boolean_ | `true` |
| overlay-class | 自定义遮罩层类名 | _string \| Array \| object_ | - | | overlay-class | 自定义遮罩层类名 | _string \| Array \| object_ | - |

View File

@ -1,6 +1,6 @@
@import '../style/mixins/hairline'; @import '../style/mixins/hairline';
body { :root {
--van-action-sheet-max-height: 80%; --van-action-sheet-max-height: 80%;
--van-action-sheet-header-height: 48px; --van-action-sheet-header-height: 48px;
--van-action-sheet-header-font-size: var(--van-font-size-lg); --van-action-sheet-header-font-size: var(--van-font-size-lg);

View File

@ -5,6 +5,7 @@ export const ActionSheet = withInstall(_ActionSheet);
export default ActionSheet; export default ActionSheet;
export { actionSheetProps } from './ActionSheet'; export { actionSheetProps } from './ActionSheet';
export type { ActionSheetProps, ActionSheetAction } from './ActionSheet'; export type { ActionSheetProps, ActionSheetAction } from './ActionSheet';
export type { ActionSheetThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,23 @@
export type ActionSheetThemeVars = {
actionSheetMaxHeight?: string;
actionSheetHeaderHeight?: string;
actionSheetHeaderFontSize?: string;
actionSheetDescriptionColor?: string;
actionSheetDescriptionFontSize?: string;
actionSheetDescriptionLineHeight?: number | string;
actionSheetItemBackground?: string;
actionSheetItemFontSize?: string;
actionSheetItemLineHeight?: number | string;
actionSheetItemTextColor?: string;
actionSheetItemDisabledTextColor?: string;
actionSheetSubnameColor?: string;
actionSheetSubnameFontSize?: string;
actionSheetSubnameLineHeight?: number | string;
actionSheetCloseIconSize?: string;
actionSheetCloseIconColor?: string;
actionSheetCloseIconPadding?: string;
actionSheetCancelTextColor?: string;
actionSheetCancelPaddingTop?: string;
actionSheetCancelPaddingColor?: string;
actionSheetLoadingIconSize?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-address-edit-padding: var(--van-padding-sm); --van-address-edit-padding: var(--van-padding-sm);
--van-address-edit-buttons-padding: var(--van-padding-xl) --van-address-edit-buttons-padding: var(--van-padding-xl)
var(--van-padding-base); var(--van-padding-base);

View File

@ -8,6 +8,7 @@ export type { AddressEditProps };
export type { export type {
AddressEditInfo, AddressEditInfo,
AddressEditInstance, AddressEditInstance,
AddressEditThemeVars,
AddressEditSearchItem, AddressEditSearchItem,
} from './types'; } from './types';

View File

@ -27,3 +27,10 @@ export type AddressEditInstance = ComponentPublicInstance<
AddressEditProps, AddressEditProps,
AddressEditExpose AddressEditExpose
>; >;
export type AddressEditThemeVars = {
addressEditPadding?: string;
addressEditButtonsPadding?: string;
addressEditButtonMarginBottom?: string;
addressEditButtonFontSize?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-address-list-padding: var(--van-padding-sm) var(--van-padding-sm) 80px; --van-address-list-padding: var(--van-padding-sm) var(--van-padding-sm) 80px;
--van-address-list-disabled-text-color: var(--van-text-color-2); --van-address-list-disabled-text-color: var(--van-text-color-2);
--van-address-list-disabled-text-padding: calc(var(--van-padding-base) * 5) 0; --van-address-list-disabled-text-padding: calc(var(--van-padding-base) * 5) 0;

View File

@ -6,6 +6,7 @@ export default AddressList;
export { addressListProps } from './AddressList'; export { addressListProps } from './AddressList';
export type { AddressListProps } from './AddressList'; export type { AddressListProps } from './AddressList';
export type { AddressListAddress } from './AddressListItem'; export type { AddressListAddress } from './AddressListItem';
export type { AddressListThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,15 @@
export type AddressListThemeVars = {
addressListPadding?: string;
addressListDisabledTextColor?: string;
addressListDisabledTextPadding?: string;
addressListDisabledTextFontSize?: string;
addressListDisabledTextLineHeight?: number | string;
addressListAddButtonZIndex?: number | string;
addressListItemPadding?: string;
addressListItemTextColor?: string;
addressListItemDisabledTextColor?: string;
addressListItemFontSize?: string;
addressListItemLineHeight?: number | string;
addressListRadioColor?: string;
addressListEditIconSize?: string;
};

View File

@ -52,7 +52,7 @@ export default {
### @vant/area-data ### @vant/area-data
Vant officially provides a default China area data, which can be imported through [@vant/area-data](https://github.com/vant-ui/vant/tree/dev/packages/vant-area-data): Vant officially provides a default China area data, which can be imported through [@vant/area-data](https://github.com/vant-ui/vant/tree/main/packages/vant-area-data):
```bash ```bash
# with npm # with npm

View File

@ -54,7 +54,7 @@ const areaList = {
### @vant/area-data ### @vant/area-data
Vant 官方提供了一份默认的中国省市区数据,可以通过 [@vant/area-data](https://github.com/vant-ui/vant/tree/dev/packages/vant-area-data) 引入: Vant 官方提供了一份默认的中国省市区数据,可以通过 [@vant/area-data](https://github.com/vant-ui/vant/tree/main/packages/vant-area-data) 引入:
```bash ```bash
# 通过 npm # 通过 npm

View File

@ -1,4 +1,4 @@
body { :root {
--van-badge-size: 16px; --van-badge-size: 16px;
--van-badge-color: var(--van-white); --van-badge-color: var(--van-white);
--van-badge-padding: 0 3px; --van-badge-padding: 0 3px;

View File

@ -5,6 +5,7 @@ export const Badge = withInstall(_Badge);
export default Badge; export default Badge;
export { badgeProps } from './Badge'; export { badgeProps } from './Badge';
export type { BadgeProps, BadgePosition } from './Badge'; export type { BadgeProps, BadgePosition } from './Badge';
export type { BadgeThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,12 @@
export type BadgeThemeVars = {
badgeSize?: string;
badgeColor?: string;
badgePadding?: string;
badgeFontSize?: string;
badgeFontWeight?: string;
badgeBorderWidth?: string;
badgeBackground?: string;
badgeDotColor?: string;
badgeDotSize?: string;
badgeFont?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-button-mini-height: 24px; --van-button-mini-height: 24px;
--van-button-mini-padding: 0 var(--van-padding-base); --van-button-mini-padding: 0 var(--van-padding-base);
--van-button-mini-font-size: var(--van-font-size-xs); --van-button-mini-font-size: var(--van-font-size-xs);

View File

@ -8,6 +8,7 @@ export type { ButtonProps } from './Button';
export type { export type {
ButtonType, ButtonType,
ButtonSize, ButtonSize,
ButtonThemeVars,
ButtonNativeType, ButtonNativeType,
ButtonIconPosition, ButtonIconPosition,
} from './types'; } from './types';

View File

@ -12,3 +12,40 @@ export type ButtonSize = 'large' | 'normal' | 'small' | 'mini';
export type ButtonNativeType = NonNullable<ButtonHTMLAttributes['type']>; export type ButtonNativeType = NonNullable<ButtonHTMLAttributes['type']>;
export type ButtonIconPosition = 'left' | 'right'; export type ButtonIconPosition = 'left' | 'right';
export type ButtonThemeVars = {
buttonMiniHeight?: string;
buttonMiniPadding?: string;
buttonMiniFontSize?: string;
buttonSmallHeight?: string;
buttonSmallPadding?: string;
buttonSmallFontSize?: string;
buttonNormalPadding?: string;
buttonNormalFontSize?: string;
buttonLargeHeight?: string;
buttonDefaultHeight?: string;
buttonDefaultLineHeight?: number | string;
buttonDefaultFontSize?: string;
buttonDefaultColor?: string;
buttonDefaultBackground?: string;
buttonDefaultBorderColor?: string;
buttonPrimaryColor?: string;
buttonPrimaryBackground?: string;
buttonPrimaryBorderColor?: string;
buttonSuccessColor?: string;
buttonSuccessBackground?: string;
buttonSuccessBorderColor?: string;
buttonDangerColor?: string;
buttonDangerBackground?: string;
buttonDangerBorderColor?: string;
buttonWarningColor?: string;
buttonWarningBackground?: string;
buttonWarningBorderColor?: string;
buttonBorderWidth?: string;
buttonRadius?: string;
buttonRoundRadius?: string;
buttonPlainBackground?: string;
buttonDisabledOpacity?: number | string;
buttonIconSize?: string;
buttonLoadingIconSize?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-calendar-background: var(--van-background-2); --van-calendar-background: var(--van-background-2);
--van-calendar-popup-height: 80%; --van-calendar-popup-height: 80%;
--van-calendar-header-shadow: 0 2px 10px rgba(125, 126, 128, 0.16); --van-calendar-header-shadow: 0 2px 10px rgba(125, 126, 128, 0.16);

View File

@ -10,6 +10,7 @@ export type {
CalendarDayItem, CalendarDayItem,
CalendarDayType, CalendarDayType,
CalendarInstance, CalendarInstance,
CalendarThemeVars,
} from './types'; } from './types';
declare module 'vue' { declare module 'vue' {

View File

@ -48,3 +48,32 @@ export type CalendarMonthInstance = ComponentPublicInstance<
disabledDays: Ref<ComputedRef<CalendarDayItem[]>>; disabledDays: Ref<ComputedRef<CalendarDayItem[]>>;
} }
>; >;
export type CalendarThemeVars = {
calendarBackground?: string;
calendarPopupHeight?: string;
calendarHeaderShadow?: string;
calendarHeaderTitleHeight?: string;
calendarHeaderTitleFontSize?: string;
calendarHeaderSubtitleFontSize?: string;
calendarWeekdaysHeight?: string;
calendarWeekdaysFontSize?: string;
calendarMonthTitleFontSize?: string;
calendarMonthMarkColor?: string;
calendarMonthMarkFontSize?: string;
calendarDayHeight?: string;
calendarDayFontSize?: string;
calendarDayMarginBottom?: string;
calendarRangeEdgeColor?: string;
calendarRangeEdgeBackground?: string;
calendarRangeMiddleColor?: string;
calendarRangeMiddleBackgroundOpacity?: number | string;
calendarSelectedDaySize?: string;
calendarSelectedDayColor?: string;
calendarInfoFontSize?: string;
calendarInfoLineHeight?: number | string;
calendarSelectedDayBackground?: string;
calendarDayDisabledColor?: string;
calendarConfirmButtonHeight?: string;
calendarConfirmButtonMargin?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-card-padding: var(--van-padding-xs) var(--van-padding-md); --van-card-padding: var(--van-padding-xs) var(--van-padding-md);
--van-card-font-size: var(--van-font-size-sm); --van-card-font-size: var(--van-font-size-sm);
--van-card-text-color: var(--van-text-color); --van-card-text-color: var(--van-text-color);

View File

@ -5,6 +5,7 @@ export const Card = withInstall(_Card);
export default Card; export default Card;
export { cardProps } from './Card'; export { cardProps } from './Card';
export type { CardProps } from './Card'; export type { CardProps } from './Card';
export type { CardThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,18 @@
export type CardThemeVars = {
cardPadding?: string;
cardFontSize?: string;
cardTextColor?: string;
cardBackground?: string;
cardThumbSize?: string;
cardThumbRadius?: string;
cardTitleLineHeight?: number | string;
cardDescColor?: string;
cardDescLineHeight?: number | string;
cardPriceColor?: string;
cardOriginPriceColor?: string;
cardNumColor?: string;
cardOriginPriceFontSize?: string;
cardPriceFontSize?: string;
cardPriceIntegerFontSize?: string;
cardPriceFont?: string;
};

View File

@ -255,7 +255,7 @@ export default {
| closeable | Whether to show close icon | _boolean_ | `true` | | closeable | Whether to show close icon | _boolean_ | `true` |
| show-header `v3.4.2` | Whether to show header | _boolean_ | `true` | | show-header `v3.4.2` | Whether to show header | _boolean_ | `true` |
| close-icon `v3.0.10` | Close icon name | _string_ | `cross` | | close-icon `v3.0.10` | Close icon name | _string_ | `cross` |
| field-names `v3.0.4` | Custom the fields of options | _object_ | `{ text: 'text', value: 'value', children: 'children' }` | | field-names `v3.0.4` | Custom the fields of options | _CascaderFieldNames_ | `{ text: 'text', value: 'value', children: 'children' }` |
### Data Structure of CascaderOption ### Data Structure of CascaderOption

View File

@ -265,7 +265,7 @@ export default {
| closeable | 是否显示关闭图标 | _boolean_ | `true` | | closeable | 是否显示关闭图标 | _boolean_ | `true` |
| show-header `v3.4.2` | 是否展示标题栏 | _boolean_ | `true` | | show-header `v3.4.2` | 是否展示标题栏 | _boolean_ | `true` |
| close-icon `v3.0.10` | 关闭图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ | `cross` | | close-icon `v3.0.10` | 关闭图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ | `cross` |
| field-names `v3.0.4` | 自定义 `options` 结构中的字段 | _object_ | `{ text: 'text', value: 'value', children: 'children' }` | | field-names `v3.0.4` | 自定义 `options` 结构中的字段 | _CascaderFieldNames_ | `{ text: 'text', value: 'value', children: 'children' }` |
### CascaderOption 数据结构 ### CascaderOption 数据结构

View File

@ -1,4 +1,4 @@
body { :root {
--van-cascader-header-height: 48px; --van-cascader-header-height: 48px;
--van-cascader-header-padding: 0 var(--van-padding-md); --van-cascader-header-padding: 0 var(--van-padding-md);
--van-cascader-title-font-size: var(--van-font-size-lg); --van-cascader-title-font-size: var(--van-font-size-lg);

View File

@ -5,7 +5,11 @@ export const Cascader = withInstall(_Cascader);
export default Cascader; export default Cascader;
export { cascaderProps } from './Cascader'; export { cascaderProps } from './Cascader';
export type { CascaderProps } from './Cascader'; export type { CascaderProps } from './Cascader';
export type { CascaderOption, CascaderFieldNames } from './types'; export type {
CascaderOption,
CascaderThemeVars,
CascaderFieldNames,
} from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -111,7 +111,7 @@ exports[`should update tabs when previous tab is clicked 1`] = `
<div style="transition-duration: 0ms; transform: translateX(0px); width: 200px;" <div style="transition-duration: 0ms; transform: translateX(0px); width: 200px;"
class="van-swipe__track" class="van-swipe__track"
> >
<div class="van-swipe-item van-tab__panel-wrapper van-tab__panel-wrapper--inactive" <div class="van-swipe-item van-tab__panel-wrapper"
id="van-tab" id="van-tab"
role="tabpanel" role="tabpanel"
tabindex="-1" tabindex="-1"

View File

@ -21,3 +21,19 @@ export type CascaderFieldNames = {
value?: string; value?: string;
children?: string; children?: string;
}; };
export type CascaderThemeVars = {
cascaderHeaderHeight?: string;
cascaderHeaderPadding?: string;
cascaderTitleFontSize?: string;
cascaderTitleLineHeight?: number | string;
cascaderCloseIconSize?: string;
cascaderCloseIconColor?: string;
cascaderSelectedIconSize?: string;
cascaderTabsHeight?: string;
cascaderActiveColor?: string;
cascaderOptionsHeight?: string;
cascaderOptionDisabledColor?: string;
cascaderTabColor?: string;
cascaderUnselectedTabColor?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-cell-group-background: var(--van-background-2); --van-cell-group-background: var(--van-background-2);
--van-cell-group-title-color: var(--van-text-color-2); --van-cell-group-title-color: var(--van-text-color-2);
--van-cell-group-title-padding: var(--van-padding-md) var(--van-padding-md); --van-cell-group-title-padding: var(--van-padding-md) var(--van-padding-md);

View File

@ -5,6 +5,7 @@ export const CellGroup = withInstall(_CellGroup);
export default CellGroup; export default CellGroup;
export { cellGroupProps } from './CellGroup'; export { cellGroupProps } from './CellGroup';
export type { CellGroupProps } from './CellGroup'; export type { CellGroupProps } from './CellGroup';
export type { CellGroupThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,10 @@
export type CellGroupThemeVars = {
cellGroupBackground?: string;
cellGroupTitleColor?: string;
cellGroupTitlePadding?: string;
cellGroupTitleFontSize?: string;
cellGroupTitleLineHeight?: number | string;
cellGroupInsetPadding?: string;
cellGroupInsetRadius?: string;
cellGroupInsetTitlePadding?: string;
};

View File

@ -1,6 +1,6 @@
@import '../style/mixins/hairline'; @import '../style/mixins/hairline';
body { :root {
--van-cell-font-size: var(--van-font-size-md); --van-cell-font-size: var(--van-font-size-md);
--van-cell-line-height: 24px; --van-cell-line-height: 24px;
--van-cell-vertical-padding: 10px; --van-cell-vertical-padding: 10px;

View File

@ -5,6 +5,7 @@ export const Cell = withInstall(_Cell);
export default Cell; export default Cell;
export { cellProps } from './Cell'; export { cellProps } from './Cell';
export type { CellSize, CellProps, CellArrowDirection } from './Cell'; export type { CellSize, CellProps, CellArrowDirection } from './Cell';
export type { CellThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,21 @@
export type CellThemeVars = {
cellFontSize?: string;
cellLineHeight?: number | string;
cellVerticalPadding?: string;
cellHorizontalPadding?: string;
cellTextColor?: string;
cellBackground?: string;
cellBorderColor?: string;
cellActiveColor?: string;
cellRequiredColor?: string;
cellLabelColor?: string;
cellLabelFontSize?: string;
cellLabelLineHeight?: number | string;
cellLabelMarginTop?: string;
cellValueColor?: string;
cellIconSize?: string;
cellRightIconColor?: string;
cellLargeVerticalPadding?: string;
cellLargeTitleFontSize?: string;
cellLargeLabelFontSize?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-checkbox-size: 20px; --van-checkbox-size: 20px;
--van-checkbox-border-color: var(--van-gray-5); --van-checkbox-border-color: var(--van-gray-5);
--van-checkbox-duration: var(--van-duration-fast); --van-checkbox-duration: var(--van-duration-fast);

View File

@ -8,6 +8,7 @@ export type { CheckboxProps } from './Checkbox';
export type { export type {
CheckboxShape, CheckboxShape,
CheckboxInstance, CheckboxInstance,
CheckboxThemeVars,
CheckboxLabelPosition, CheckboxLabelPosition,
} from './types'; } from './types';

View File

@ -17,3 +17,15 @@ export type CheckboxInstance = ComponentPublicInstance<
CheckboxProps, CheckboxProps,
CheckboxExpose CheckboxExpose
>; >;
export type CheckboxThemeVars = {
checkboxSize?: string;
checkboxBorderColor?: string;
checkboxDuration?: string;
checkboxLabelMargin?: string;
checkboxLabelColor?: string;
checkboxCheckedIconColor?: string;
checkboxDisabledIconColor?: string;
checkboxDisabledLabelColor?: string;
checkboxDisabledBackground?: string;
};

View File

@ -1,4 +1,4 @@
body { :root {
--van-circle-size: 100px; --van-circle-size: 100px;
--van-circle-color: var(--van-primary-color); --van-circle-color: var(--van-primary-color);
--van-circle-layer-color: var(--van-white); --van-circle-layer-color: var(--van-white);

View File

@ -5,6 +5,7 @@ export const Circle = withInstall(_Circle);
export default Circle; export default Circle;
export { circleProps } from './Circle'; export { circleProps } from './Circle';
export type { CircleProps, CircleStartPosition } from './Circle'; export type { CircleProps, CircleStartPosition } from './Circle';
export type { CircleThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,9 @@
export type CircleThemeVars = {
circleSize?: string;
circleColor?: string;
circleLayerColor?: string;
circleTextColor?: string;
circleTextFontWeight?: string;
circleTextFontSize?: string;
circleTextLineHeight?: number | string;
};

View File

@ -1,6 +1,6 @@
@import '../style/mixins/hairline'; @import '../style/mixins/hairline';
body { :root {
--van-collapse-item-duration: var(--van-duration-base); --van-collapse-item-duration: var(--van-duration-base);
--van-collapse-item-content-padding: var(--van-padding-sm) --van-collapse-item-content-padding: var(--van-padding-sm)
var(--van-padding-md); var(--van-padding-md);

View File

@ -5,7 +5,7 @@ export const CollapseItem = withInstall(_CollapseItem);
export default CollapseItem; export default CollapseItem;
export { collapseItemProps } from './CollapseItem'; export { collapseItemProps } from './CollapseItem';
export type { CollapseItemProps } from './CollapseItem'; export type { CollapseItemProps } from './CollapseItem';
export type { CollapseItemInstance } from './types'; export type { CollapseItemInstance, CollapseItemThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -9,3 +9,13 @@ export type CollapseItemInstance = ComponentPublicInstance<
CollapseItemProps, CollapseItemProps,
CollapseItemExpose CollapseItemExpose
>; >;
export type CollapseItemThemeVars = {
collapseItemDuration?: string;
collapseItemContentPadding?: string;
collapseItemContentFontSize?: string;
collapseItemContentLineHeight?: number | string;
collapseItemContentTextColor?: string;
collapseItemContentBackground?: string;
collapseItemTitleDisabledColor?: string;
};

View File

@ -73,10 +73,10 @@ export default defineComponent({
if (inBrowser) { if (inBrowser) {
const addTheme = () => { const addTheme = () => {
document.body.classList.add(`van-theme-${props.theme}`); document.documentElement.classList.add(`van-theme-${props.theme}`);
}; };
const removeTheme = (theme = props.theme) => { const removeTheme = (theme = props.theme) => {
document.body.classList.remove(`van-theme-${theme}`); document.documentElement.classList.remove(`van-theme-${theme}`);
}; };
watch( watch(

View File

@ -28,6 +28,15 @@ In takes effect globally, making all Vant components on the page dark.
<van-config-provider theme="dark">...</van-config-provider> <van-config-provider theme="dark">...</van-config-provider>
``` ```
The theme prop will not change the text-color or background-color of the page, you can set it manually like this:
```css
.van-theme-dark body {
text-color: #f5f5f5;
background-color: black;
}
```
> Tips: The theme prop will not change the background color of the page, you need to set it manually. > Tips: The theme prop will not change the background color of the page, you need to set it manually.
### Switch Theme ### Switch Theme
@ -69,10 +78,10 @@ Looking at the style of the Button component, you can see that the following var
} }
``` ```
The default values of these variables are defined on the `body` node: The default values of these variables are defined on the `:root` node:
```css ```css
body { :root {
--van-white: #fff; --van-white: #fff;
--van-blue: #1989fa; --van-blue: #1989fa;
--van-button-primary-color: var(--van-white); --van-button-primary-color: var(--van-white);
@ -88,7 +97,7 @@ You can directly override these CSS variables in the code, and the style of the
```css ```css
/* the Primary Button will turn red */ /* the Primary Button will turn red */
body { :root {
--van-button-primary-background: red; --van-button-primary-background: red;
} }
``` ```
@ -150,6 +159,18 @@ export default {
> Tips: ConfigProvider only affects its child components. > Tips: ConfigProvider only affects its child components.
#### Use In TypeScript
Using `ConfigProviderThemeVars` type to get code intellisense.
```ts
import type { ConfigProviderThemeVars } from 'vant';
const themeVars: ConfigProviderThemeVars = {
sliderBarHeight: '4px',
};
```
### Combining dark mode with CSS variables ### Combining dark mode with CSS variables
If you need to define CSS variables for dark mode or light mode separately, you can use the `theme-vars-dark` and `theme-vars-light` props. If you need to define CSS variables for dark mode or light mode separately, you can use the `theme-vars-dark` and `theme-vars-light` props.
@ -197,8 +218,10 @@ CSS variables in Vant are divided into **basic variables** and **component varia
#### Modify Basic Variables #### Modify Basic Variables
- The basic variables can only be modified through the `body` selector. - The basic variables can only be modified through the `:root` selector.
- The component variables can be modified through the `body` selector and `ConfigProvider` component. - The component variables can be modified through the `:root` selector and `ConfigProvider` component.
You can also use the `.van-theme-light` and `.van-theme-dark` class selector to modify basic or component variables in light or dark mode individually.
#### Variables List #### Variables List
@ -299,5 +322,9 @@ There are all **Basic Variables** below, for component CSS Variables, please ref
The component exports the following type definitions: The component exports the following type definitions:
```ts ```ts
import type { ConfigProviderProps, ConfigProviderTheme } from 'vant'; import type {
ConfigProviderProps,
ConfigProviderTheme,
ConfigProviderThemeVars,
} from 'vant';
``` ```

View File

@ -28,7 +28,14 @@ app.use(ConfigProvider);
<van-config-provider theme="dark">...</van-config-provider> <van-config-provider theme="dark">...</van-config-provider>
``` ```
> Tips: 开启深色模式不会改变页面的背景色,需要手动进行设置。 值得注意的是,开启 Vant 的深色模式只会影响 Vant 组件的 UI并不会影响全局的文字颜色或背景颜色你可以参考以下 CSS 来设置一些全局样式:
```css
.van-theme-dark body {
text-color: #f5f5f5;
background-color: black;
}
```
### 动态切换 ### 动态切换
@ -69,10 +76,10 @@ Vant 组件通过丰富的 [CSS 变量](https://developer.mozilla.org/zh-CN/docs
} }
``` ```
这些变量的默认值被定义在 `body` 节点上body 下所有子节点都可以访问到这些变量: 这些变量的默认值被定义在 `:root` 节点上HTML 里的所有子节点都可以访问到这些变量:
```css ```css
body { :root {
--van-white: #fff; --van-white: #fff;
--van-blue: #1989fa; --van-blue: #1989fa;
--van-button-primary-color: var(--van-white); --van-button-primary-color: var(--van-white);
@ -88,7 +95,7 @@ body {
```css ```css
/* 添加这段样式后Primary Button 会变成红色 */ /* 添加这段样式后Primary Button 会变成红色 */
body { :root {
--van-button-primary-background: red; --van-button-primary-background: red;
} }
``` ```
@ -148,7 +155,19 @@ export default {
}; };
``` ```
> 注意ConfigProvider 仅影响它的子组件的样式,不影响全局 body 节点。 > 注意ConfigProvider 仅影响它的子组件的样式,不影响全局 root 节点。
#### 在 TypeScript 中使用
在 TypeScript 中定义 themeVars 时,建议使用 Vant 提供的 `ConfigProviderThemeVars` 类型,可以提供完善的类型提示:
```ts
import type { ConfigProviderThemeVars } from 'vant';
const themeVars: ConfigProviderThemeVars = {
sliderBarHeight: '4px',
};
```
### 结合深色模式与 CSS 变量 ### 结合深色模式与 CSS 变量
@ -199,8 +218,10 @@ Vant 中的 CSS 变量分为 **基础变量** 和 **组件变量**。组件变
由于 CSS 变量继承机制的原因,两者的修改方式有一定差异: 由于 CSS 变量继承机制的原因,两者的修改方式有一定差异:
- 基础变量只能通过 `body 选择器` 修改,不能通过 `ConfigProvider 组件` 修改。 - 基础变量只能通过 `:root 选择器` 修改,不能通过 `ConfigProvider 组件` 修改。
- 组件变量可以通过 `body 选择器``ConfigProvider 组件` 修改。 - 组件变量可以通过 `:root 选择器``ConfigProvider 组件` 修改。
你也可以使用 `.van-theme-light``.van-theme-dark` 这两个类名选择器来单独修改浅色或深色模式下的基础变量和组件变量。
#### 变量列表 #### 变量列表
@ -303,5 +324,9 @@ Vant 中的 CSS 变量分为 **基础变量** 和 **组件变量**。组件变
组件导出以下类型定义: 组件导出以下类型定义:
```ts ```ts
import type { ConfigProviderProps, ConfigProviderTheme } from 'vant'; import type {
ConfigProviderProps,
ConfigProviderTheme,
ConfigProviderThemeVars,
} from 'vant';
``` ```

View File

@ -8,6 +8,7 @@ export type {
ConfigProviderProps, ConfigProviderProps,
ConfigProviderTheme, ConfigProviderTheme,
} from './ConfigProvider'; } from './ConfigProvider';
export type { ConfigProviderThemeVars } from './types';
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {

View File

@ -0,0 +1,72 @@
export type ConfigProviderThemeVars =
import('../action-bar').ActionBarThemeVars &
import('../action-bar-button').ActionBarButtonThemeVars &
import('../action-bar-icon').ActionBarIconThemeVars &
import('../action-sheet').ActionSheetThemeVars &
import('../address-edit').AddressEditThemeVars &
import('../address-list').AddressListThemeVars &
import('../badge').BadgeThemeVars &
import('../button').ButtonThemeVars &
import('../calendar').CalendarThemeVars &
import('../card').CardThemeVars &
import('../cascader').CascaderThemeVars &
import('../cell').CellThemeVars &
import('../cell-group').CellGroupThemeVars &
import('../checkbox').CheckboxThemeVars &
import('../circle').CircleThemeVars &
import('../collapse-item').CollapseItemThemeVars &
import('../contact-card').ContactCardThemeVars &
import('../contact-edit').ContactEditThemeVars &
import('../contact-list').ContactListThemeVars &
import('../count-down').CountDownThemeVars &
import('../coupon').CouponThemeVars &
import('../coupon-cell').CouponCellThemeVars &
import('../coupon-list').CouponListThemeVars &
import('../dialog').DialogThemeVars &
import('../divider').DividerThemeVars &
import('../dropdown-item').DropdownItemThemeVars &
import('../dropdown-menu').DropdownMenuThemeVars &
import('../empty').EmptyThemeVars &
import('../field').FieldThemeVars &
import('../grid-item').GridItemThemeVars &
import('../image').ImageThemeVars &
import('../image-preview').ImagePreviewThemeVars &
import('../index-anchor').IndexAnchorThemeVars &
import('../index-bar').IndexBarThemeVars &
import('../list').ListThemeVars &
import('../loading').LoadingThemeVars &
import('../nav-bar').NavBarThemeVars &
import('../notice-bar').NoticeBarThemeVars &
import('../notify').NotifyThemeVars &
import('../number-keyboard').NumberKeyboardThemeVars &
import('../overlay').OverlayThemeVars &
import('../pagination').PaginationThemeVars &
import('../password-input').PasswordInputThemeVars &
import('../picker').PickerThemeVars &
import('../picker-group').PickerGroupThemeVars &
import('../popover').PopoverThemeVars &
import('../popup').PopupThemeVars &
import('../progress').ProgressThemeVars &
import('../pull-refresh').PullRefreshThemeVars &
import('../radio').RadioThemeVars &
import('../rate').RateThemeVars &
import('../search').SearchThemeVars &
import('../share-sheet').ShareSheetThemeVars &
import('../sidebar').SidebarThemeVars &
import('../sidebar-item').SidebarItemThemeVars &
import('../skeleton').SkeletonThemeVars &
import('../slider').SliderThemeVars &
import('../step').StepThemeVars &
import('../stepper').StepperThemeVars &
import('../steps').StepsThemeVars &
import('../sticky').StickyThemeVars &
import('../submit-bar').SubmitBarThemeVars &
import('../swipe').SwipeThemeVars &
import('../switch').SwitchThemeVars &
import('../tabbar').TabbarThemeVars &
import('../tabbar-item').TabbarItemThemeVars &
import('../tabs').TabsThemeVars &
import('../tag').TagThemeVars &
import('../toast').ToastThemeVars &
import('../tree-select').TreeSelectThemeVars &
import('../uploader').UploaderThemeVars;

Some files were not shown because too many files have changed in this diff Show More