mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-06 06:41:06 +08:00
Compare commits
4 Commits
3e039b02b5
...
bc024a105c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc024a105c | ||
|
|
7afb74345a | ||
|
|
65fdb2155b | ||
|
|
c6bc97f4e4 |
@ -18,10 +18,10 @@
|
||||
"devDependencies": {
|
||||
"@vant/cli": "workspace:*",
|
||||
"@vant/eslint-config": "workspace:*",
|
||||
"eslint": "^8.2.0",
|
||||
"eslint": "^8.23.0",
|
||||
"husky": "^8.0.1",
|
||||
"nano-staged": "^0.8.0",
|
||||
"prettier": "^2.5.0",
|
||||
"prettier": "^2.7.1",
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
"pnpm": {
|
||||
|
||||
@ -32,15 +32,15 @@
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/inquirer": "^8.1.3",
|
||||
"release-it": "^15.1.1",
|
||||
"typescript": "^4.7.4"
|
||||
"@types/inquirer": "^8.2.3",
|
||||
"release-it": "^15.4.1",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"consola": "^2.11.3",
|
||||
"fast-glob": "^3.2.4",
|
||||
"fs-extra": "^10.0.0",
|
||||
"inquirer": "^8.0.0",
|
||||
"fast-glob": "^3.2.11",
|
||||
"fs-extra": "^10.1.0",
|
||||
"inquirer": "^8.2.4",
|
||||
"picocolors": "^1.0.0"
|
||||
},
|
||||
"release-it": {
|
||||
|
||||
@ -36,9 +36,9 @@
|
||||
"author": "chenjiahan",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.14.29",
|
||||
"release-it": "^15.1.1",
|
||||
"typescript": "^4.7.4"
|
||||
"esbuild": "^0.14.54",
|
||||
"release-it": "^15.4.1",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
|
||||
@ -39,56 +39,56 @@
|
||||
"author": "chenjiahan",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@jest/types": "^27.5.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/less": "^3.0.3",
|
||||
"@types/markdown-it": "^12.2.3",
|
||||
"@jest/types": "^27",
|
||||
"vue": "^3.2.27",
|
||||
"react": "^18",
|
||||
"react-dom": "^18"
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"vue": "^3.2.38"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/preset-typescript": "^7.16.0",
|
||||
"@docsearch/css": "^3.0.0",
|
||||
"@docsearch/js": "^3.0.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"@vant/eslint-config": "^3.3.2",
|
||||
"@vant/touch-emulator": "^1.3.2",
|
||||
"@vitejs/plugin-vue": "^3.0.1",
|
||||
"@vitejs/plugin-vue-jsx": "^2.0.0",
|
||||
"@babel/core": "^7.18.13",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@docsearch/css": "^3.2.1",
|
||||
"@docsearch/js": "^3.2.1",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@vant/eslint-config": "^3.5.0",
|
||||
"@vant/touch-emulator": "^1.4.0",
|
||||
"@vitejs/plugin-vue": "^3.0.3",
|
||||
"@vitejs/plugin-vue-jsx": "^2.0.1",
|
||||
"@vue/babel-plugin-jsx": "^1.1.1",
|
||||
"autoprefixer": "^10.4.0",
|
||||
"commander": "^9.3.0",
|
||||
"autoprefixer": "^10.4.8",
|
||||
"commander": "^9.4.0",
|
||||
"consola": "^2.15.3",
|
||||
"conventional-changelog": "^3.1.24",
|
||||
"esbuild": "^0.14.29",
|
||||
"eslint": "^8.1.0",
|
||||
"conventional-changelog": "^3.1.25",
|
||||
"esbuild": "^0.14.54",
|
||||
"eslint": "^8.23.0",
|
||||
"execa": "^5.1.1",
|
||||
"fast-glob": "^3.2.7",
|
||||
"fs-extra": "^10.0.0",
|
||||
"fast-glob": "^3.2.11",
|
||||
"fs-extra": "^10.1.0",
|
||||
"hash-sum": "^2.0.0",
|
||||
"highlight.js": "^11.3.1",
|
||||
"highlight.js": "^11.6.0",
|
||||
"husky": "^8.0.1",
|
||||
"jest": "^27.3.1",
|
||||
"jest-canvas-mock": "^2.3.1",
|
||||
"jest": "^27.5.1",
|
||||
"jest-canvas-mock": "^2.4.0",
|
||||
"jest-serializer-html": "^7.1.0",
|
||||
"less": "^4.1.2",
|
||||
"markdown-it": "^12.2.0",
|
||||
"markdown-it-anchor": "^8.4.1",
|
||||
"less": "^4.1.3",
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-anchor": "^8.6.4",
|
||||
"nano-staged": "^0.8.0",
|
||||
"nanospinner": "^1.1.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"postcss": "^8.3.11",
|
||||
"postcss-load-config": "^3.1.0",
|
||||
"prettier": "^2.5.0",
|
||||
"release-it": "^15.1.1",
|
||||
"transliteration": "^2.2.0",
|
||||
"typescript": "^4.7.4",
|
||||
"vite": "^3.0.0",
|
||||
"vite-plugin-html": "^2.1.1",
|
||||
"vite-plugin-md": "^0.11.4",
|
||||
"vue-router": "^4.0.12"
|
||||
"postcss": "^8.4.16",
|
||||
"postcss-load-config": "^3.1.4",
|
||||
"prettier": "^2.7.1",
|
||||
"release-it": "^15.4.1",
|
||||
"transliteration": "^2.3.5",
|
||||
"typescript": "^4.8.2",
|
||||
"vite": "^3.0.9",
|
||||
"vite-plugin-html": "^2.1.2",
|
||||
"vite-plugin-md": "^0.11.9",
|
||||
"vue-router": "^4.1.5"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
|
||||
@ -20,17 +20,17 @@
|
||||
"author": "chenjiahan",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.3",
|
||||
"@typescript-eslint/parser": "^5.30.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
||||
"@typescript-eslint/parser": "^5.36.1",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-vue": "^9.1.1"
|
||||
"eslint-plugin-vue": "^9.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"enhanced-resolve": "^5.10.0",
|
||||
"eslint": "^8.19.0",
|
||||
"typescript": "^4.7.4"
|
||||
"eslint": "^8.23.0",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^7.32.0 || ^8.2.0"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
"author": "chenjiahan",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"release-it": "^15.1.1"
|
||||
"release-it": "^15.4.1"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
|
||||
@ -37,12 +37,12 @@
|
||||
"author": "chenjiahan",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.9.2"
|
||||
"@popperjs/core": "^2.11.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.14.29",
|
||||
"release-it": "^15.1.1",
|
||||
"typescript": "^4.7.4"
|
||||
"esbuild": "^0.14.54",
|
||||
"release-it": "^15.4.1",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
|
||||
@ -37,10 +37,10 @@
|
||||
"author": "chenjiahan",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.14.29",
|
||||
"release-it": "^15.1.1",
|
||||
"typescript": "^4.7.4",
|
||||
"vue": "^3.2.27"
|
||||
"esbuild": "^0.14.54",
|
||||
"release-it": "^15.4.1",
|
||||
"typescript": "^4.8.2",
|
||||
"vue": "^3.2.38"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
|
||||
@ -19,6 +19,18 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
|
||||
|
||||
## Details
|
||||
|
||||
### [v3.6.2](https://github.com/vant-ui/vant/compare/v3.6.1...v3.6.2)
|
||||
|
||||
`2022-09-04`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- reduce passive event warning of touchmove event [#10975](https://github.com/vant-ui/vant/issues/10975)
|
||||
- Calendar: allow default date to be maxDate when enable allowSameDay [#10976](https://github.com/vant-ui/vant/issues/10976) [#10971](https://github.com/vant-ui/vant/issues/10971)
|
||||
- indexBar: index-bar not positioned correctly when scrolled to the bottom [#10994](https://github.com/vant-ui/vant/issues/10994)
|
||||
- Swipe: should not prevent touch move when reach edge [#10980](https://github.com/vant-ui/vant/issues/10980)
|
||||
- @vant/area-data: update counties of Daxinganling region [#11000](https://github.com/vant-ui/vant/issues/11000)
|
||||
|
||||
### [v3.6.1](https://github.com/vant-ui/vant/compare/v3.6.0...v3.6.1)
|
||||
|
||||
`2022-08-24`
|
||||
|
||||
@ -19,6 +19,18 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
||||
|
||||
## 更新内容
|
||||
|
||||
### [v3.6.2](https://github.com/vant-ui/vant/compare/v3.6.1...v3.6.2)
|
||||
|
||||
`2022-09-04`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- 修复 touchmove 事件导致控制台出现 passive event warning 的问题 [#10975](https://github.com/vant-ui/vant/issues/10975)
|
||||
- Calendar: 修复使用 allow-same-day 属性时 default-date 不能设置为同一天的问题 [#10976](https://github.com/vant-ui/vant/issues/10976) [#10971](https://github.com/vant-ui/vant/issues/10971)
|
||||
- indexBar: 修复个别情况下无法滚动到正确位置的问题 [#10994](https://github.com/vant-ui/vant/issues/10994)
|
||||
- Swipe: 修复 touchmove 事件在边界情况下被 preventDefault 的问题 [#10980](https://github.com/vant-ui/vant/issues/10980)
|
||||
- @vant/area-data: 更新大兴安岭相关地区码 [#11000](https://github.com/vant-ui/vant/issues/11000)
|
||||
|
||||
### [v3.6.1](https://github.com/vant-ui/vant/compare/v3.6.0...v3.6.1)
|
||||
|
||||
`2022-08-24`
|
||||
|
||||
@ -93,9 +93,9 @@ pnpm add vant
|
||||
|
||||
## 引入组件
|
||||
|
||||
### 方法一. 基础用法
|
||||
### 方法一. 常规用法
|
||||
|
||||
下面是使用 Vant 组件的基础用法示例:
|
||||
下面是使用 Vant 组件的用法示例:
|
||||
|
||||
```js
|
||||
import { createApp } from 'vue';
|
||||
@ -110,15 +110,15 @@ const app = createApp();
|
||||
app.use(Button);
|
||||
```
|
||||
|
||||
Vant 支持多种组件注册方式,除了在 app 上全局注册组件,你也可以选择其他的方式,详见 [组件注册](#/zh-CN/advanced-usage#zu-jian-zhu-ce) 章节。
|
||||
Vant 支持多种组件注册方式,除了在 app 上全局注册组件,你也可以选择其他的方式,比如局部注册,详见 [组件注册](#/zh-CN/advanced-usage#zu-jian-zhu-ce) 章节。
|
||||
|
||||
> 提示:Vant 默认支持 Tree Shaking,因此你不需要配置任何插件,通过 Tree Shaking 即可移除不需要的 JS 代码,但 CSS 样式无法通过这种方式优化,如果需要按需引入 CSS 样式,请参考下面的方法二。
|
||||
|
||||
### 方法二. 按需引入组件
|
||||
### 方法二. 按需引入组件样式
|
||||
|
||||
在基于 `vite`、`webpack` 或 `vue-cli` 的项目中使用 Vant 时,可以使用 [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components) 插件,它可以自动引入组件,并按需引入组件的样式。
|
||||
|
||||
相比于基础用法,这种方式可以按需引入组件的 CSS 样式,从而减少一部分代码体积。
|
||||
相比于常规用法,这种方式可以按需引入组件的 CSS 样式,从而减少一部分代码体积,但使用起来会变得繁琐一些。如果业务对 CSS 的体积要求不是特别极致,我们推荐使用更简便的常规用法。
|
||||
|
||||
#### 1. 安装插件
|
||||
|
||||
@ -240,3 +240,34 @@ export default defineNuxtConfig({
|
||||
|
||||
- [nuxt/framework#6761](https://github.com/nuxt/framework/issues/6761)
|
||||
- [nuxt/framework#4084](https://github.com/nuxt/framework/issues/4084)
|
||||
|
||||
## 迁移提示
|
||||
|
||||
### 移除 babel-plugin-import
|
||||
|
||||
从 Vant 4.0 版本开始,将不再支持 `babel-plugin-import`,请移除项目中依赖的 `babel-plugin-import` 插件。
|
||||
|
||||
只需要删除 `babel.config.js` 中的以下代码即可:
|
||||
|
||||
```diff
|
||||
module.exports = {
|
||||
plugins: [
|
||||
- ['import', {
|
||||
- libraryName: 'vant',
|
||||
- libraryDirectory: 'es',
|
||||
- style: true
|
||||
- }, 'vant']
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
#### 收益
|
||||
|
||||
移除 `babel-plugin-import` 有以下收益:
|
||||
|
||||
- 不再强依赖 babel,项目可以使用 esbuild、swc 等更高效的编译工具,大幅度提升编译效率。
|
||||
- 不再受到 `babel-plugin-import` 的 import 写法限制,可以从 vant 中导入除了组件以外的其他内容,比如 Vant 4 中新增的 `showToast` 等方法:
|
||||
|
||||
```ts
|
||||
import { showToast, showDialog } from 'vant';
|
||||
```
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vant",
|
||||
"version": "3.6.1",
|
||||
"version": "3.6.2",
|
||||
"description": "Lightweight Mobile UI Components built on Vue",
|
||||
"main": "lib/vant.cjs.js",
|
||||
"module": "es/index.mjs",
|
||||
@ -52,15 +52,15 @@
|
||||
"vue": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16",
|
||||
"@types/node": "^16.11.56",
|
||||
"@vant/area-data": "workspace:*",
|
||||
"@vant/cli": "workspace:*",
|
||||
"@vant/eslint-config": "workspace:*",
|
||||
"@vue/runtime-core": "^3.2.27",
|
||||
"@vue/test-utils": "^2.0.1",
|
||||
"typescript": "^4.7.4",
|
||||
"vue": "^3.2.27",
|
||||
"vue-router": "^4.0.12"
|
||||
"@vue/runtime-core": "^3.2.38",
|
||||
"@vue/test-utils": "^2.0.2",
|
||||
"typescript": "^4.8.2",
|
||||
"vue": "^3.2.38",
|
||||
"vue-router": "^4.1.5"
|
||||
},
|
||||
"sideEffects": [
|
||||
"es/**/style/*",
|
||||
|
||||
@ -149,7 +149,7 @@ test('set min-minute dynamically', async () => {
|
||||
triggerDrag(wrapper.find('.van-picker-column'), 0, -100);
|
||||
wrapper.find('.van-picker__confirm').trigger('click');
|
||||
await later();
|
||||
expect(wrapper.emitted<[string]>('change')![0][0]).toEqual('13:00');
|
||||
expect(wrapper.emitted<[string]>('change')![0][0]).toEqual('12:30');
|
||||
});
|
||||
|
||||
test('should emit value correctly when dynamic change min-hour', async () => {
|
||||
|
||||
@ -34,8 +34,8 @@ test('should trigger onClose option correctly', async () => {
|
||||
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
expect(onClose).toHaveBeenCalledWith({
|
||||
index: 0,
|
||||
url: images[0],
|
||||
index: 1,
|
||||
url: images[1],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -29,7 +29,10 @@ function genBem(name: string, mods?: Mods): string {
|
||||
}
|
||||
|
||||
if (Array.isArray(mods)) {
|
||||
return mods.reduce<string>((ret, item) => ret + genBem(name, item), '');
|
||||
return (mods as Mod[]).reduce<string>(
|
||||
(ret, item) => ret + genBem(name, item),
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
return Object.keys(mods).reduce(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { App } from 'vue';
|
||||
import { camelize } from './format';
|
||||
import type { App, Component } from 'vue';
|
||||
|
||||
// https://github.com/vant-ui/vant/issues/8302
|
||||
type EventShim = {
|
||||
@ -14,11 +14,13 @@ export type WithInstall<T> = T & {
|
||||
install(app: App): void;
|
||||
} & EventShim;
|
||||
|
||||
export function withInstall<T>(options: T) {
|
||||
export function withInstall<T extends Component>(options: T) {
|
||||
(options as Record<string, unknown>).install = (app: App) => {
|
||||
const { name } = options as unknown as { name: string };
|
||||
app.component(name, options);
|
||||
app.component(camelize(`-${name}`), options);
|
||||
const { name } = options;
|
||||
if (name) {
|
||||
app.component(name, options);
|
||||
app.component(camelize(`-${name}`), options);
|
||||
}
|
||||
};
|
||||
|
||||
return options as WithInstall<T>;
|
||||
|
||||
1518
pnpm-lock.yaml
generated
1518
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user