diff --git a/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml b/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml index c778ac024..1383c7a5a 100644 --- a/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml +++ b/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml @@ -16,7 +16,7 @@ body: id: reproduce attributes: label: 重现链接 - description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/m5v3f) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 + description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/vant-3-issue-template-8fuq5o) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 validations: required: true diff --git a/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml b/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml index 929bc04d5..bfa3a70cc 100644 --- a/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml +++ b/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml @@ -16,7 +16,7 @@ body: id: reproduce attributes: label: 重现链接 - description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/m5v3f) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 + description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/vant-3-issue-template-8fuq5o) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 validations: required: true diff --git a/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml b/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml index 669444b35..5ec2e8adc 100644 --- a/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml +++ b/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml @@ -7,7 +7,7 @@ body: id: reproduce attributes: label: Reproduction Link - description: Please provide a simple [codesandbox](https://codesandbox.io/s/m5v3f) or GitHub repository link. Do not fill in invalid links, this will cause your issue to be closed directly. + description: Please provide a simple [codesandbox](https://codesandbox.io/s/vant-3-issue-template-8fuq5o) or GitHub repository link. Do not fill in invalid links, this will cause your issue to be closed directly. validations: required: true diff --git a/README.md b/README.md index 5d2c6146d..61999dfc6 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ - 🍭 Support Tree Shaking - 🍭 Support Custom Theme - 🍭 Support Accessibility (still improving) +- 🍭 Support Dark Mode (Requires upgrade to [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/en-US/config-provider)) - 🍭 Support i18n - 🍭 Support Dark Mode - 🌍 Support SSR diff --git a/README.zh-CN.md b/README.zh-CN.md index 14eaef864..1c1dcc5d9 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -41,6 +41,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源 - 🍭 支持主题定制,内置 700+ 个主题变量 - 🍭 支持按需引入和 Tree Shaking - 🍭 支持无障碍访问(持续改进中) +- 🍭 支持深色模式(需要升级至 [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/zh-CN/config-provider)) - 🍭 支持服务器端渲染 - 🍭 支持深色模式 - 🌍 支持国际化和语言包定制 diff --git a/packages/vant-area-data/README.md b/packages/vant-area-data/README.md index 74093e1ec..60e57bdf7 100644 --- a/packages/vant-area-data/README.md +++ b/packages/vant-area-data/README.md @@ -1,6 +1,6 @@ # Vant Area Data -省市区数据,适用于 Vant Area 组件。 +中国省市区数据,适用于 Vant Area 组件。 ## 安装 @@ -20,3 +20,7 @@ pnpm add @vant/area-data ```ts import { areaList } from '@vant/area-data'; ``` + +## 数据更新 + +中国的行政区划每年都会有变动,如果发现省市区数据未及时更新,欢迎提 Pull Request 帮助我们更新。 diff --git a/packages/vant-area-data/package.json b/packages/vant-area-data/package.json index 1085b649b..4657d0bd1 100644 --- a/packages/vant-area-data/package.json +++ b/packages/vant-area-data/package.json @@ -1,6 +1,6 @@ { "name": "@vant/area-data", - "version": "1.2.2", + "version": "1.2.3", "description": "Vant 省市区数据", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", diff --git a/packages/vant-area-data/src/index.ts b/packages/vant-area-data/src/index.ts index c67673a0d..5c8ef7332 100644 --- a/packages/vant-area-data/src/index.ts +++ b/packages/vant-area-data/src/index.ts @@ -1175,6 +1175,7 @@ export const areaList = { 320105: '建邺区', 320106: '鼓楼区', 320111: '浦口区', + 320112: '江北新区', 320113: '栖霞区', 320114: '雨花台区', 320115: '江宁区', diff --git a/packages/vant/docs/markdown/faq.zh-CN.md b/packages/vant/docs/markdown/faq.zh-CN.md index 7564b0cf9..21bca55bb 100644 --- a/packages/vant/docs/markdown/faq.zh-CN.md +++ b/packages/vant/docs/markdown/faq.zh-CN.md @@ -62,6 +62,12 @@ Vant 基于 CSS 变量提供了主题定制的能力,可以对组件样式进 参考链接:[stackoverflow - :active pseudo-class doesn't work in mobile safari](https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari/33681490#33681490) +### 为什么没有 Select 组件? + +Select 是桌面端常用的组件,但它的交互形式不适合移动端。 + +在移动端,我们推荐使用 [Picker 选择器组件](#/zh-CN/picker) 作为代替。 + ### 部分组件无法在桌面端进行操作? 参见[桌面端适配](#/zh-CN/advanced-usage#zhuo-mian-duan-gua-pei)。 diff --git a/packages/vant/docs/markdown/home.en-US.md b/packages/vant/docs/markdown/home.en-US.md index 02261da66..d676a5d0d 100644 --- a/packages/vant/docs/markdown/home.en-US.md +++ b/packages/vant/docs/markdown/home.en-US.md @@ -18,6 +18,7 @@ - 🍭 Support Tree Shaking - 🍭 Support Custom Theme - 🍭 Support Accessibility (still improving) +- 🍭 Support Dark Mode (Requires upgrade to [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/en-US/config-provider)) - 🍭 Support i18n - 🍭 Support Dark Mode - 🌍 Support SSR diff --git a/packages/vant/docs/markdown/home.zh-CN.md b/packages/vant/docs/markdown/home.zh-CN.md index c1c502fe6..c9df21e0b 100644 --- a/packages/vant/docs/markdown/home.zh-CN.md +++ b/packages/vant/docs/markdown/home.zh-CN.md @@ -28,6 +28,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源 - 🍭 支持主题定制,内置 700+ 个主题变量 - 🍭 支持按需引入和 Tree Shaking - 🍭 支持无障碍访问(持续改进中) +- 🍭 支持深色模式(需要升级至 [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/zh-CN/config-provider)) - 🍭 支持服务器端渲染 - 🍭 支持深色模式 - 🌍 支持国际化和语言包定制 diff --git a/packages/vant/src/area/README.md b/packages/vant/src/area/README.md index 9dd385804..6de29d52c 100644 --- a/packages/vant/src/area/README.md +++ b/packages/vant/src/area/README.md @@ -52,7 +52,7 @@ export default { ### @vant/area-data -Vant officially provides a default area data, which can be imported through [@vant/area-data](https://github.com/youzan/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/youzan/vant/tree/dev/packages/vant-area-data): ```bash # with npm diff --git a/packages/vant/src/area/README.zh-CN.md b/packages/vant/src/area/README.zh-CN.md index c897b4e91..f4b52edac 100644 --- a/packages/vant/src/area/README.zh-CN.md +++ b/packages/vant/src/area/README.zh-CN.md @@ -54,7 +54,7 @@ const areaList = { ### @vant/area-data -Vant 官方提供了一份默认的省市区数据,可以通过 [@vant/area-data](https://github.com/youzan/vant/tree/dev/packages/vant-area-data) 引入: +Vant 官方提供了一份默认的中国省市区数据,可以通过 [@vant/area-data](https://github.com/youzan/vant/tree/dev/packages/vant-area-data) 引入: ```bash # 通过 npm @@ -77,6 +77,8 @@ export default { }; ``` +> Tips: 中国的行政区划每年都会有变动,如果发现省市区数据未及时更新,欢迎提 Pull Request 帮助我们更新。 + ### 控制选中项 通过 `v-model` 绑定当前选中的地区码。 diff --git a/packages/vant/src/index-bar/IndexBar.tsx b/packages/vant/src/index-bar/IndexBar.tsx index d127039a0..5213aebdd 100644 --- a/packages/vant/src/index-bar/IndexBar.tsx +++ b/packages/vant/src/index-bar/IndexBar.tsx @@ -81,6 +81,7 @@ export default defineComponent({ const touch = useTouch(); const scrollParent = useScrollParent(root); const { children, linkChildren } = useChildren(INDEX_BAR_KEY); + let selectActiveIndex: string; linkChildren({ props }); @@ -116,6 +117,9 @@ export default defineComponent({ return -1; }; + const getMatchAnchor = (index: string) => + children.find((item) => String(item.index) === index); + const onScroll = () => { if (isHidden(root)) { return; @@ -129,7 +133,16 @@ export default defineComponent({ item.getRect(scrollParent.value, scrollParentRect) ); - const active = getActiveAnchor(scrollTop, rects); + let active = -1; + if (selectActiveIndex) { + const match = getMatchAnchor(selectActiveIndex); + if (match) { + const rect = match.getRect(scrollParent.value, scrollParentRect); + active = getActiveAnchor(rect.top, rects); + } + } else { + active = getActiveAnchor(scrollTop, rects); + } activeAnchor.value = indexList[active]; @@ -150,7 +163,7 @@ export default defineComponent({ state.top = Math.max(props.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top; - } else if (index === active - 1) { + } else if (index === active - 1 && selectActiveIndex === '') { const activeItemTop = rects[active].top - scrollTop; state.active = activeItemTop > 0; state.top = @@ -160,6 +173,8 @@ export default defineComponent({ } }); } + + selectActiveIndex = ''; }; const init = () => { @@ -193,10 +208,19 @@ export default defineComponent({ }); const scrollTo = (index: string | number) => { - index = String(index); - const match = children.find((item) => String(item.index) === index); + selectActiveIndex = String(index); + const match = getMatchAnchor(selectActiveIndex); if (match) { + const scrollTop = getScrollTop(scrollParent.value!); + const scrollParentRect = useRect(scrollParent); + const { offsetHeight } = document.documentElement; + + if (scrollTop === offsetHeight - scrollParentRect.height) { + onScroll(); + return; + } + match.$el.scrollIntoView(); if (props.sticky && props.stickyOffsetTop) { diff --git a/packages/vant/src/locale/README.md b/packages/vant/src/locale/README.md index c4ff8a9fd..c3d8cc8bb 100644 --- a/packages/vant/src/locale/README.md +++ b/packages/vant/src/locale/README.md @@ -52,6 +52,7 @@ Current supported languages: | Italian | it-IT | `v3.4.5` | | Japanese | ja-JP | - | | Korean | ko-KR | `v3.4.3` | +| Lao | la-LA | `v3.4.7` | | Norwegian | nb-NO | - | | Portuguese (Brazil) | pt-BR | `v3.3.3` | | Romanian | ro-RO | - | diff --git a/packages/vant/src/locale/README.zh-CN.md b/packages/vant/src/locale/README.zh-CN.md index a73634c1a..29db1db15 100644 --- a/packages/vant/src/locale/README.zh-CN.md +++ b/packages/vant/src/locale/README.zh-CN.md @@ -53,6 +53,7 @@ Locale.add(messages); | 意大利语 | it-IT | `v3.4.5` | | 日语 | ja-JP | - | | 韩语/朝鲜语 | ko-KR | `v3.4.3` | +| 老挝语 | la-LA | `v3.4.7` | | 挪威语 | nb-NO | - | | 葡萄牙语(巴西) | pt-BR | `v3.3.3` | | 罗马尼亚语 | ro-RO | - | diff --git a/packages/vant/src/locale/lang/la-LA.ts b/packages/vant/src/locale/lang/la-LA.ts new file mode 100644 index 000000000..a6b3c97f6 --- /dev/null +++ b/packages/vant/src/locale/lang/la-LA.ts @@ -0,0 +1,64 @@ +export default { + name: 'ຊື່', + tel: 'ໂທລະສັບ', + save: 'ບັນທຶກ', + confirm: 'ຢຶນຢັນ', + cancel: 'ຍົກເລີກ', + delete: 'ລືບ', + loading: 'ກຳລັງໂຫຼດ...', + noCoupon: 'ບໍ່ມີຄູປອງ', + nameEmpty: 'ກະລຸນາປ້ອນຊື່', + addContact: 'ເພີ່ມຜູ້ຕິດຕໍ່', + telInvalid: 'ເບີໂທລະສັບບໍ່ຖືກຕ້ອງ', + vanCalendar: { + end: 'ຈົບ', + start: 'ເລີ່ມ', + title: 'ການເລືອກວັນທີ່', + weekdays: ['ອາ', 'ຈ', 'ອ', 'ພ', 'ພຫ', 'ສ', 'ສ'], + monthTitle: (year: number, month: number) => `${year}ປີ${month}ເດືອນ`, + rangePrompt: (maxRange: number) => + `ຈຳນອນວັນທີ່ເລືອກຕ້ອງບໍ່ເກີນ ${maxRange} ວັນ`, + }, + vanCascader: { + select: 'ກະລຸນາເລືອກ', + }, + vanPagination: { + prev: 'ໜ້າທີ່ແລ້ວ', + next: 'ໜ້າຕໍ່ໄປ', + }, + vanPullRefresh: { + pulling: 'ດືງລົງເພື່ອຣີເຟສ...', + loosing: 'ປ່ອຍເພື່ອຣີເຟສ...', + }, + vanSubmitBar: { + label: 'ລວມ:', + }, + vanCoupon: { + unlimited: 'ບໍ່ ຈຳກັດ', + discount: (discount: number) => `ລົດ${discount}`, + condition: (condition: number) => `ມີຈຳໜ່າຍໃນລາຄາ ${condition} ກວ່າຫຍວນ`, + }, + vanCouponCell: { + title: 'ຄູປອງ', + count: (count: number) => `ມີຮູບພາບ ${count} ຮູບ`, + }, + vanCouponList: { + exchange: 'ແລກປ່ຽນ', + close: 'ບໍ່ໄດ້ໃຊ້', + enable: 'ພ້ອມໃຊ້ງານ', + disabled: 'ບໍ່ພ້ອມໃຊ້ງານ', + placeholder: 'ກະລຸນາປ້ອນຄູປອງ', + }, + vanAddressEdit: { + area: 'ພື້ນທີ່', + postal: 'ລະຫັດໄປສະນີ', + areaEmpty: 'ກະລຸນາເລືອກພື້ນທີ່', + addressEmpty: 'ກະລຸນາປ້ອນທີ່ຢູ່', + postalEmpty: 'ກະລຸນາປ້ອນລະຫັດໄປສະນີ', + addressDetail: 'ທີ່ຢູ່', + defaultAddress: 'ຕັ້ງເປັນທີ່ຢູ່ເລີ່ມຕົ້ນ', + }, + vanAddressList: { + add: 'ເພີ່ມທີ່ຢູ່', + }, +};