Compare commits

...

44 Commits
v1.11.2 ... dev

Author SHA1 Message Date
neverland
e5af691c4c
docs: redirect from the old domain (#5811) 2024-06-02 18:13:20 +08:00
neverland
c6b4004893
docs: add new document site URL (#5810)
* docs: add new document site URL

* fix: proxy
2024-06-02 18:11:02 +08:00
landluck
db1c0ce662
feat(Cascader): add ellipsis prop support (#5806) 2024-05-31 11:58:36 +08:00
neverland
1a8351387a
chore: bump @vant/cli v7 (#5801)
* chore: bump @vant/cli v7

* fix: lint

* fix: disable source-map to support Node 18
2024-05-26 10:54:01 +08:00
neverland
2543148507
chore(workflow): generate changelog via GitHub (#5800) 2024-05-26 10:15:24 +08:00
landluck
2266cbe262 docs(changelog): @vant/weapp 1.11.6 2024-05-14 20:52:29 +08:00
landluck
809bc84d1e release: 1.11.6 2024-05-14 20:46:46 +08:00
landluck
e5f462263b build: compile 1.11.6 2024-05-14 20:46:42 +08:00
PuffMeow
22f39e86b9
feat(uploader): add referrer policy prop support (#5770) 2024-05-14 20:35:16 +08:00
landluck
ff982f6cd0
fix(field): fixed clear button incorrectly displaying when value has default value (#5792) 2024-05-14 20:26:21 +08:00
xiejiahe
178795253f
docs: Fix the Stepper event callback parameter (#5778) 2024-05-14 20:25:40 +08:00
zzxqd
443e78daec
fix(Cascader): fix display erro after the value is reassigned void (#5760) 2024-05-06 10:08:49 +08:00
dependabot[bot]
07dfcafb26
build(deps): bump ejs from 3.1.8 to 3.1.10 (#5773)
Bumps [ejs](https://github.com/mde/ejs) from 3.1.8 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.8...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-06 10:08:03 +08:00
xiejiahe
ebba3b14a1
docs(button): fix missing doc for hover-class prop 2024-05-06 10:07:47 +08:00
neverland
04c8783b1d
chore(workflow): fix failed to deploy website (#5776) 2024-05-02 14:59:13 +08:00
neverland
c38c931325
docs: remove all Gitee links (#5774) 2024-05-02 14:14:33 +08:00
landluck
ab45d8011c docs(changelog): @vant/weapp 1.11.5 2024-04-15 10:53:00 +08:00
landluck
8953dd3ed9 release: 1.11.5 2024-04-15 10:47:28 +08:00
landluck
2680fedace build: compile 1.11.5 2024-04-15 10:47:24 +08:00
Xavi Lee
68be39fea2
docs: remove unnecessary step in quickstart (#5744) 2024-04-15 10:29:46 +08:00
xiami
979fc92bdc
feat(input): support input nickname event (#5758) 2024-04-12 17:42:18 +08:00
Lick-liu
348c3103b7
fix(van-stepper): fix onChange event exceeded 'max' after setting the max prop (#5741) 2024-04-12 17:40:56 +08:00
Skiyee
50da9f87eb
fix(Transition): fix cannot find method observeDuration (#5743) 2024-04-12 17:35:08 +08:00
dependabot[bot]
fc1ad93c57
build(deps-dev): bump @babel/plugin-transform-modules-commonjs (#5752)
Bumps [@babel/plugin-transform-modules-commonjs](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-modules-commonjs) from 7.23.3 to 7.24.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.1/packages/babel-plugin-transform-modules-commonjs)

---
updated-dependencies:
- dependency-name: "@babel/plugin-transform-modules-commonjs"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-12 17:23:16 +08:00
dependabot[bot]
902579a94a
build(deps): bump vite from 2.9.17 to 2.9.18 (#5755)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 2.9.17 to 2.9.18.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v2.9.18/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v2.9.18/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-12 17:22:07 +08:00
dependabot[bot]
cce61c26af
build(deps): bump vite from 2.9.16 to 2.9.17 (#5704)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 2.9.16 to 2.9.17.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v2.9.17/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v2.9.17/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-12 20:16:14 +08:00
dependabot[bot]
5b9f52b7ef
build(deps): bump es5-ext from 0.10.53 to 0.10.63 (#5724)
Bumps [es5-ext](https://github.com/medikoo/es5-ext) from 0.10.53 to 0.10.63.
- [Release notes](https://github.com/medikoo/es5-ext/releases)
- [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md)
- [Commits](https://github.com/medikoo/es5-ext/compare/v0.10.53...v0.10.63)

---
updated-dependencies:
- dependency-name: es5-ext
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-12 20:15:08 +08:00
dependabot[bot]
aac785bc2c
build(deps-dev): bump vue from 3.3.9 to 3.4.21 (#5730)
Bumps [vue](https://github.com/vuejs/core) from 3.3.9 to 3.4.21.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.3.9...v3.4.21)

---
updated-dependencies:
- dependency-name: vue
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-12 20:14:49 +08:00
landluck
4db5b132d1 docs(changelog): @vant/weapp 1.11.4 2024-01-23 10:01:22 +08:00
landluck
c7e8ab5ef3 release: 1.11.4 2024-01-23 09:57:11 +08:00
landluck
9130ebf59c release: 1.11.4-beta.0 2024-01-22 19:32:02 +08:00
landluck
cdb692fbec build: compile 1.11.4-beta.0 2024-01-22 19:31:58 +08:00
xiami
b9f88ec64a
fix(Transition): fix transition event sequence (#5707) 2024-01-22 19:29:18 +08:00
landluck
c0b7537da9 docs(changelog): @vant/weapp 1.11.3 2024-01-16 12:09:37 +08:00
landluck
c4b3609370 release: 1.11.3 2024-01-16 11:45:14 +08:00
landluck
040416bdb7 release: 1.11.3-beta.0 2024-01-16 11:21:55 +08:00
landluck
7c0c9e43f7 build: compile 1.11.3-beta.0 2024-01-16 11:21:51 +08:00
johnsonwong666
ff8fe1cb69
feat(goods-action-button): add custom-style prop support (#5659) 2024-01-16 11:17:36 +08:00
johnsonwong666
628008efb3
fix(Cascader): fix title slot inoperative (#5676) 2024-01-15 20:16:45 +08:00
johnsonwong666
3f8cc449d2
feat(Calendar、ActionSheet、Dialog、ShareSheet): add root portal prop (#5680) 2024-01-15 19:55:11 +08:00
dependabot[bot]
e2b031c436
build(deps-dev): bump miniprogram-api-typings from 3.12.1 to 3.12.2 (#5686)
Bumps [miniprogram-api-typings](https://github.com/wechat-miniprogram/api-typings) from 3.12.1 to 3.12.2.
- [Changelog](https://github.com/wechat-miniprogram/api-typings/blob/master/CHANGELOG.md)
- [Commits](https://github.com/wechat-miniprogram/api-typings/compare/v3.12.1...v3.12.2)

---
updated-dependencies:
- dependency-name: miniprogram-api-typings
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 19:53:33 +08:00
johnsonwong666
d1f505b8e8
feat(Upload): support mix mediaType #5690 2024-01-15 19:53:05 +08:00
johnsonwong666
19083a327c
fix(Transition): fix transition event sequence (#5699) 2024-01-15 19:47:25 +08:00
landluck
f2ff0e7b48 docs(changelog): @vant/weapp 1.11.2 2023-12-05 17:30:59 +08:00
103 changed files with 2753 additions and 3654 deletions

View File

@ -1,3 +1,3 @@
你好,请使用下面的链接创建 issue 以帮助我们更快的排查问题,不规范的 issue 会被关闭,感谢配合。
http://vant-contrib.gitee.io/vant-issue-generater?repo=VantWeapp
http://vant-ui.github.io/vant-issue-generater?repo=VantWeapp

10
.github/pr-labeler.yml vendored Normal file
View File

@ -0,0 +1,10 @@
"change: feat":
- "/^(feat|types|style)/"
"change: fix":
- "/^fix/"
"change: perf":
- "/^perf/"
"change: breaking":
- "/^breaking change/"
"change: docs":
- "/^docs/"

View File

@ -7,6 +7,8 @@ on:
- 'docs/**/*.md'
- 'packages/**/*.md'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
@ -22,9 +24,16 @@ jobs:
- name: Build Site
run: npx --no-install vant-cli build-site
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.1
- name: Deploy for GitHub 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.0
with:
branch: gh-pages
folder: site-dist
clean-exclude: 0.x
token: ${{ secrets.VANT_UI_TOKEN }}
repository-name: vant-ui/vant-ui.github.io
target-folder: vant-weapp
# enable single-commit to reduce the repo size
single-commit: true
clean: true
clean-exclude: |
0.x

20
.github/workflows/pr-label.yaml vendored Normal file
View File

@ -0,0 +1,20 @@
name: PR Labeler
on:
pull_request_target:
types:
- opened
- edited
jobs:
change-labeling:
name: Labeling for changes
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v3.4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/pr-labeler.yml
enable-versioned-regex: 0
include-title: 1
sync-labels: 1

View File

@ -11,13 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Create Release for Tag
id: release_tag
uses: yyx990803/release-tag@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
generateReleaseNotes: "true"
body: |
更新内容参见 [CHANGELOG](https://vant-contrib.gitee.io/vant-weapp/#/changelog)
> 请访问 [更新日志](https://vant-ui.github.io/vant-weapp/#/changelog) 了解所有更新

View File

@ -1,20 +0,0 @@
name: Sync to Gitee
on:
push:
branches: [dev, gh-pages]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Sync to Gitee
uses: wearerequired/git-mirror-action@master
env:
# 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
with:
# 注意替换为你的 GitHub 源仓库地址
source-repo: git@github.com:youzan/vant-weapp.git
# 注意替换为你的 Gitee 目标仓库地址
destination-repo: git@gitee.com:vant-contrib/vant-weapp.git

View File

@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '18.x'
- name: Install dependencies
uses: bahmutov/npm-install@v1
@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '18.x'
- name: Install dependencies
uses: bahmutov/npm-install@v1
@ -47,7 +47,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '18.x'
- name: Install dependencies
uses: bahmutov/npm-install@v1

View File

@ -11,9 +11,9 @@
</p>
<p align="center">
🔥 <a href="https://vant-contrib.gitee.io/vant-weapp">文档网站(国内)</a>
🔥 <a href="https://vant.pro/vant-weapp/">文档网站(国内)</a>
&nbsp;
🌈 <a href="https://youzan.github.io/vant-weapp">文档网站GitHub</a>
🔥 <a href="https://vant-ui.github.io/vant-weapp/">文档网站GitHub</a>
&nbsp;
🚀 <a href="https://github.com/vant-ui/vant" target="_blank">Vue 版</a>
</p>
@ -24,7 +24,7 @@
Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
目前 Vant 官方提供了 [Vue 2 版本](https://vant-ui.github.io/vant/v2/)、[Vue 3 版本](https://vant-ui.github.io/vant/)和[微信小程序版本](http://vant-ui.github.io/vant-weapp/),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
## 预览
@ -99,9 +99,11 @@ Vant Weapp 最低支持到小程序基础库 2.6.5 版本。
## 链接
- [文档网站GitHub](https://vant-ui.github.io/vant-weapp/)
- [文档网站(国内)](https://vant.pro/vant-weapp/)
- [意见反馈](https://github.com/youzan/vant-weapp/issues)
- [设计资源](https://vant-contrib.gitee.io/vant/#/zh-CN/design)
- [更新日志](https://vant-contrib.gitee.io/vant-weapp/#/changelog)
- [设计资源](https://vant-ui.github.io/vant/#/zh-CN/design)
- [更新日志](https://vant-ui.github.io/vant-weapp/#/changelog)
- [官方示例](https://github.com/vant-ui/vant-demo)
## 核心团队

View File

@ -28,7 +28,4 @@ then
else
npm publish
fi
# changelog
vant-cli changelog
fi

View File

@ -36,6 +36,10 @@ VantComponent({
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onSelect(event) {

View File

@ -9,6 +9,7 @@
custom-class="van-action-sheet custom-class"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">

View File

@ -113,6 +113,10 @@ VantComponent({
value: 0,
},
readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
subtitle: '',

View File

@ -13,6 +13,7 @@
closeable="{{ showTitle || showSubtitle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:enter="onOpen"
bind:close="onClose"
bind:after-enter="onOpened"

View File

@ -49,6 +49,7 @@ VantComponent({
value: defaultFieldNames,
observer: 'updateFieldNames',
},
useTitleSlot: Boolean,
},
data: {
tabs: [],
@ -147,6 +148,7 @@ VantComponent({
selected: null,
},
],
activeTab: 0,
});
},
onClose() {

View File

@ -1,7 +1,8 @@
<wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header">
<text class="van-cascader__title"><slot name="title"></slot>{{ title }}</text>
<slot name="title" wx:if="{{ useTitleSlot }}"></slot>
<text class="van-cascader__title" wx:else>{{ title }}</text>
<van-icon
wx:if="{{ closeable }}"
name="{{ closeIcon }}"

View File

@ -4,6 +4,7 @@ interface VantComponentInstance {
children: WechatMiniprogram.Component.TrivialInstance[];
index: number;
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
setView: (value: Record<string, any>, callback?: () => void) => void;
}
export type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
data?: Data;

View File

@ -65,6 +65,10 @@ VantComponent({
type: String,
value: 'scale',
},
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
loading: {

View File

@ -9,6 +9,7 @@
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view

17
dist/field/index.js vendored
View File

@ -31,6 +31,18 @@ VantComponent({
innerValue: '',
showClear: false,
},
watch: {
value(value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger() {
this.setShowClear();
},
},
created() {
this.value = this.data.value;
this.setData({ innerValue: this.value });
@ -95,6 +107,9 @@ VantComponent({
onKeyboardHeightChange(event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview(event) {
this.$emit('nicknamereview', event.detail);
},
emitChange(detail) {
const { extraEventParams } = this.data;
this.setData({ value: detail.value });
@ -116,7 +131,7 @@ VantComponent({
const trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setData({ showClear });
this.setView({ showClear });
},
noop() { },
},

View File

@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>

10
dist/field/props.js vendored
View File

@ -1,13 +1,5 @@
export const commonProps = {
value: {
type: String,
observer(value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
}
},
},
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,

View File

@ -19,6 +19,10 @@ VantComponent({
type: String,
value: 'danger',
},
customStyle: {
type: String,
value: '',
},
},
methods: {
onClick(event) {

View File

@ -12,6 +12,7 @@
open-type="{{ openType }}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}"
custom-class="van-goods-action-button__inner custom-class"
custom-style="{{customStyle}}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"

15
dist/mixins/basic.js vendored
View File

@ -7,5 +7,20 @@ export const basic = Behavior({
this.setData(data);
return new Promise((resolve) => wx.nextTick(resolve));
},
// high performance setData
setView(data, callback) {
const target = {};
let hasChange = false;
Object.keys(data).forEach((key) => {
if (data[key] !== this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});

View File

@ -21,7 +21,6 @@ export function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
@ -46,59 +45,71 @@ export function transition(showDefaultValue) {
value ? this.enter() : this.leave();
},
enter() {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.status === 'enter') {
if (this.enterFinishedPromise)
return;
}
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
this.enterFinishedPromise = new Promise((resolve) => {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
});
},
leave() {
if (!this.data.display) {
if (!this.enterFinishedPromise)
return;
}
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
this.enterFinishedPromise.then(() => {
if (!this.data.display) {
return;
}
this.$emit('leave');
this.setData({
classes: classNames.leave,
currentDuration,
});
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => this.onTransitionEnd(), currentDuration);
this.setData({ classes: classNames['leave-to'] });
this.$emit('leave');
this.setData({
classes: classNames.leave,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => {
this.onTransitionEnd();
this.enterFinishedPromise = null;
}, currentDuration);
this.setData({ classes: classNames['leave-to'] });
});
});
});
},

View File

@ -36,6 +36,10 @@ VantComponent({
type: null,
value: 300,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onClickOverlay() {

View File

@ -11,6 +11,7 @@
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:close="onClose"
bind:click-overlay="onClickOverlay"
>

View File

@ -128,12 +128,7 @@ VantComponent({
if (value === '') {
return;
}
let formatted = this.filter(value);
// limit max decimal length
if (isDef(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
const pair = formatted.split('.');
formatted = `${pair[0]}.${pair[1].slice(0, this.data.decimalLength)}`;
}
let formatted = this.format(value);
this.emitChange(formatted);
},
emitChange(value) {

View File

@ -1,7 +1,7 @@
import { VantComponent } from '../common/component';
import { isImageFile, chooseFile, isVideoFile } from './utils';
import { imageProps, videoProps, mediaProps, messageFileProps } from './shared';
import { isBoolean, isPromise } from '../common/validator';
import { imageProps, mediaProps, messageFileProps, videoProps } from './shared';
import { chooseFile, isImageFile, isVideoFile } from './utils';
VantComponent({
props: Object.assign(Object.assign(Object.assign(Object.assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null,

View File

@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"

View File

@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {

View File

@ -31,6 +31,10 @@ export const videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
export const mediaProps = {
@ -40,7 +44,7 @@ export const mediaProps = {
},
mediaType: {
type: Array,
value: ['image', 'video'],
value: ['image', 'video', 'mix'],
},
maxDuration: {
type: Number,

View File

@ -33,7 +33,7 @@ function formatVideo(res) {
];
}
function formatMedia(res) {
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: res.type, url: item.tempFilePath, thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath })));
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: item.fileType, url: item.tempFilePath, thumb: item.fileType === 'video' ? item.thumbTempFilePath : item.tempFilePath })));
}
function formatFile(res) {
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { url: item.path })));

View File

@ -1,4 +1,77 @@
# 更新日志
### [v1.11.6](https://github.com/youzan/vant-weapp/compare/v1.11.5...v1.11.6)
`2024-05-14`
**Bug Fixes**
- Cascader: 修复显示错误在 value 值清空的情况下 [#5760](https://github.com/youzan/vant-weapp/issues/5760)
- Field: 修复清除按钮显示错误在 value 默认有值的情况下 [#5792](https://github.com/youzan/vant-weapp/issues/5792)
**Document**
- Button: 补全 hover-class 属性 [ebba3b](https://github.com/youzan/vant-weapp/commit/ebba3b14a133769e7b04b7a48667cbc777c280c4)
- Stepper: 修复 onChange 事件示例代码错误 [#5778](https://github.com/youzan/vant-weapp/issues/5778)
**Feature**
- Uploader: 新增 referrer-policy 属性支持 [#5770](https://github.com/youzan/vant-weapp/issues/5770)
### [v1.11.5](https://github.com/youzan/vant-weapp/compare/v1.11.4...v1.11.5)
`2024-04-15`
**Bug Fixes**
- Transition: 修复 observeDuration 方法未实现导致的报错 [#5743](https://github.com/youzan/vant-weapp/issues/5743)
- van-stepper: 修复在设置 max 属性后 onChange 结果不受限制 [#5741](https://github.com/youzan/vant-weapp/issues/5741)
**Feature**
- input: 新增 nicknamereview 事件支持 [#5758](https://github.com/youzan/vant-weapp/issues/5758)
**Document**
- docs(quickstart): 删除不需要的引导步骤 [#5744](https://github.com/youzan/vant-weapp/pull/5744)
### [v1.11.4](https://github.com/youzan/vant-weapp/compare/v1.11.3...v1.11.4)
`2024-01-22`
**Bug Fixes**
- Transition: 修复 popup 在特定情况下无法关闭 [#5707](https://github.com/youzan/vant-weapp/issues/5707)
### [v1.11.3](https://github.com/youzan/vant-weapp/compare/v1.11.2...v1.11.3)
`2024-01-16`
**Bug Fixes**
- Cascader: 修复 title slot 不生效 [#5676](https://github.com/youzan/vant-weapp/issues/5676)
- Transition: 修复 transition 多次触发 enter 时异常 [#5699](https://github.com/youzan/vant-weapp/issues/5699)
**Feature**
- Calendar、ActionSheet、Dialog、ShareSheet: 增加 root-portal 属性支持 [#5680](https://github.com/youzan/vant-weapp/issues/5680)
- goods-action-button: 增加 custom-style 属性支持 [#5659](https://github.com/youzan/vant-weapp/issues/5659)
- Upload: 增加 mix mediaType 支持 [#5690](https://github.com/youzan/vant-weapp/issues/5690)
### [v1.11.2](https://github.com/youzan/vant-weapp/compare/v1.11.1...v1.11.2)
`2023-12-05`
**Bug Fixes**
- dialog/goods-action-button: 修复 dialog、goods-action-button 组件缺少 getRealTimePhoneNumber 事件 [#5633](https://github.com/youzan/vant-weapp/issues/5633)
- upload: 修复企业微信下图片无法上传 [#5581](https://github.com/youzan/vant-weapp/issues/5581)
- calendar/input/textarea/popup: 修复 skyline 模式下组件报错问题 [#5650](https://github.com/youzan/vant-weapp/issues/5650)
**Document**
- area: 订正 columns-num 只支持 number 类型. [#5631](https://github.com/youzan/vant-weapp/issues/5631)
### [v1.11.1](https://github.com/youzan/vant-weapp/compare/v1.11.0...v1.11.1)
`2023-10-10`
@ -7,7 +80,6 @@
- icon: update @vant/icon to v3.0.1 [#5583](https://github.com/youzan/vant-weapp/issues/5583)
### [v1.11.0](https://github.com/youzan/vant-weapp/compare/v1.10.25...v1.11.0)
`2023-09-18`
@ -25,7 +97,6 @@
- icon: 升级 @vant/icon 到 [3.0.0](https://github.com/youzan/vant/blob/main/packages/vant-icons/CHANGELOG.md) [#5561](https://github.com/youzan/vant-weapp/issues/5561)
### [v1.10.25](https://github.com/youzan/vant-weapp/compare/v1.10.24...v1.10.25)
`2023-08-30`
@ -1282,7 +1353,7 @@ Rate [\#3105](https://github.com/youzan/vant-weapp/pull/3105)
微信小程序自定义组件的组件模型相当于一个简化版的 [Shadow DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom?hl=zh-CN),幸运的是,小程序也支持了 [CSS 自定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 的特性。最终,我们基于 CSS 自定义属性设计了样式定制的方案,开发者使用灵活、方便,组件维护也更简单。
从 1.0 版本开始Vant Weapp 中的所有组件都支持通过 [CSS 组定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 进行样式定制,具体使用姿势可查看[相关文档](https://youzan.github.io/vant-weapp/#/theme)
从 1.0 版本开始Vant Weapp 中的所有组件都支持通过 [CSS 组定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 进行样式定制,具体使用姿势可查看[相关文档](/vant-weapp/#/theme)
![定制主题](https://img.yzcdn.cn/public_files/2019/06/11/9a066c1a212264c7ae56065e1f13d317.png)

View File

@ -10,7 +10,7 @@
Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
目前 Vant 官方提供了 [Vue 2 版本](/vant/v2/)、[Vue 3 版本](/vant/)和[微信小程序版本](/vant-weapp/),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
### 预览
@ -27,8 +27,8 @@ Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
### 链接
- [意见反馈](https://github.com/youzan/vant-weapp/issues)
- [设计资源](https://vant-contrib.gitee.io/vant/#/zh-CN/design)
- [更新日志](https://vant-contrib.gitee.io/vant-weapp/#/changelog)
- [设计资源](/vant/#/zh-CN/design)
- [更新日志](/vant-weapp/#/changelog)
- [官方示例](https://github.com/vant-ui/vant-demo)
## 贡献

View File

@ -25,36 +25,13 @@ npm i vant-weapp -S --production
将 app.json 中的 `"style": "v2"` 去除,小程序的[新版基础组件](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#style)强行加上了许多样式,难以覆盖,不关闭将造成部分组件样式混乱。
### 步骤三 修改 project.config.json
开发者工具创建的项目,`miniprogramRoot` 默认为 `miniprogram``package.json` 在其外部npm 构建无法正常工作。
需要手动在 `project.config.json` 内添加如下配置,使开发者工具可以正确索引到 npm 依赖的位置。
```json
{
...
"setting": {
...
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./miniprogram/"
}
]
}
}
```
注意: 由于目前新版开发者工具创建的小程序目录文件结构问题npm构建的文件目录为miniprogram_npm并且开发工具会默认在当前目录下创建miniprogram_npm的文件名所以新版本的miniprogramNpmDistDir配置为'./'即可
### 步骤四 构建 npm 包
### 步骤三 构建 npm 包
打开微信开发者工具,点击 **工具 -> 构建 npm**,并勾选 **使用 npm 模块** 选项,构建完成后,即可引入组件。
<img style="width: 500px;" src="https://img.yzcdn.cn/public_files/2019/08/15/fa0549210055976cb63798503611ce3d.png" />
### 步骤 typescript 支持
### 步骤四 typescript 支持
如果你使用 typescript 开发小程序,还需要做如下操作,以获得顺畅的开发体验。

View File

@ -42,7 +42,7 @@
"condition": false
},
"compileType": "miniprogram",
"libVersion": "2.6.5",
"libVersion": "2.27.3",
"appid": "wx1c01b35002d3ba14",
"projectname": "vant-weapp",
"condition": {

View File

@ -38,6 +38,10 @@ var button_1 = require("../mixins/button");
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onSelect: function (event) {

View File

@ -9,6 +9,7 @@
custom-class="van-action-sheet custom-class"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">

View File

@ -129,6 +129,10 @@ var getTime = function (date) {
value: 0,
},
readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
subtitle: '',

View File

@ -13,6 +13,7 @@
closeable="{{ showTitle || showSubtitle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:enter="onOpen"
bind:close="onClose"
bind:after-enter="onOpened"

View File

@ -60,6 +60,7 @@ var defaultFieldNames = {
value: defaultFieldNames,
observer: 'updateFieldNames',
},
useTitleSlot: Boolean,
},
data: {
tabs: [],
@ -160,6 +161,7 @@ var defaultFieldNames = {
selected: null,
},
],
activeTab: 0,
});
},
onClose: function () {

View File

@ -1,7 +1,8 @@
<wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header">
<text class="van-cascader__title"><slot name="title"></slot>{{ title }}</text>
<slot name="title" wx:if="{{ useTitleSlot }}"></slot>
<text class="van-cascader__title" wx:else>{{ title }}</text>
<van-icon
wx:if="{{ closeable }}"
name="{{ closeIcon }}"

View File

@ -4,6 +4,7 @@ interface VantComponentInstance {
children: WechatMiniprogram.Component.TrivialInstance[];
index: number;
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
setView: (value: Record<string, any>, callback?: () => void) => void;
}
export type VantComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption> = {
data?: Data;

View File

@ -67,6 +67,10 @@ var utils_1 = require("../common/utils");
type: String,
value: 'scale',
},
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
loading: {

View File

@ -9,6 +9,7 @@
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view

View File

@ -44,6 +44,18 @@ var props_1 = require("./props");
innerValue: '',
showClear: false,
},
watch: {
value: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger: function () {
this.setShowClear();
},
},
created: function () {
this.value = this.data.value;
this.setData({ innerValue: this.value });
@ -109,6 +121,9 @@ var props_1 = require("./props");
onKeyboardHeightChange: function (event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview: function (event) {
this.$emit('nicknamereview', event.detail);
},
emitChange: function (detail) {
var extraEventParams = this.data.extraEventParams;
this.setData({ value: detail.value });
@ -130,7 +145,7 @@ var props_1 = require("./props");
var trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setData({ showClear: showClear });
this.setView({ showClear: showClear });
},
noop: function () { },
},

View File

@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>

View File

@ -2,15 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.textareaProps = exports.inputProps = exports.commonProps = void 0;
exports.commonProps = {
value: {
type: String,
observer: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
}
},
},
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,

View File

@ -21,6 +21,10 @@ var link_1 = require("../mixins/link");
type: String,
value: 'danger',
},
customStyle: {
type: String,
value: '',
},
},
methods: {
onClick: function (event) {

View File

@ -12,6 +12,7 @@
open-type="{{ openType }}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}"
custom-class="van-goods-action-button__inner custom-class"
custom-style="{{customStyle}}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"

View File

@ -10,5 +10,21 @@ exports.basic = Behavior({
this.setData(data);
return new Promise(function (resolve) { return wx.nextTick(resolve); });
},
// high performance setData
setView: function (data, callback) {
var _this = this;
var target = {};
var hasChange = false;
Object.keys(data).forEach(function (key) {
if (data[key] !== _this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});

View File

@ -24,7 +24,6 @@ function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
@ -50,60 +49,72 @@ function transition(showDefaultValue) {
},
enter: function () {
var _this = this;
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (this.status === 'enter') {
if (this.enterFinishedPromise)
return;
}
this.status = 'enter';
this.$emit('before-enter');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
this.enterFinishedPromise = new Promise(function (resolve) {
var _a = _this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (_this.status === 'enter') {
return;
}
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
_this.status = 'enter';
_this.$emit('before-enter');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
});
},
leave: function () {
var _this = this;
if (!this.data.display) {
if (!this.enterFinishedPromise)
return;
}
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
this.enterFinishedPromise.then(function () {
if (!_this.data.display) {
return;
}
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
var _a = _this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
_this.status = 'leave';
_this.$emit('before-leave');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.transitionEnded = false;
setTimeout(function () { return _this.onTransitionEnd(); }, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.transitionEnded = false;
setTimeout(function () {
_this.onTransitionEnd();
_this.enterFinishedPromise = null;
}, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
});
});
});
},

View File

@ -38,6 +38,10 @@ var component_1 = require("../common/component");
type: null,
value: 300,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onClickOverlay: function () {

View File

@ -11,6 +11,7 @@
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:close="onClose"
bind:click-overlay="onClickOverlay"
>

View File

@ -141,12 +141,7 @@ function equal(value1, value2) {
if (value === '') {
return;
}
var formatted = this.filter(value);
// limit max decimal length
if ((0, validator_1.isDef)(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
var pair = formatted.split('.');
formatted = "".concat(pair[0], ".").concat(pair[1].slice(0, this.data.decimalLength));
}
var formatted = this.format(value);
this.emitChange(formatted);
},
emitChange: function (value) {

View File

@ -12,9 +12,9 @@ var __assign = (this && this.__assign) || function () {
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("./utils");
var shared_1 = require("./shared");
var validator_1 = require("../common/validator");
var shared_1 = require("./shared");
var utils_1 = require("./utils");
(0, component_1.VantComponent)({
props: __assign(__assign(__assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null,

View File

@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"

View File

@ -29,6 +29,10 @@ export declare const videoProps: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {

View File

@ -34,6 +34,10 @@ exports.videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
exports.mediaProps = {
@ -43,7 +47,7 @@ exports.mediaProps = {
},
mediaType: {
type: Array,
value: ['image', 'video'],
value: ['image', 'video', 'mix'],
},
maxDuration: {
type: Number,

View File

@ -49,7 +49,7 @@ function formatVideo(res) {
];
}
function formatMedia(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: res.type, url: item.tempFilePath, thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath })); });
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: item.fileType, url: item.tempFilePath, thumb: item.fileType === 'video' ? item.thumbTempFilePath : item.tempFilePath })); });
}
function formatFile(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); });

View File

@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
"version": "1.11.2",
"version": "1.11.6",
"author": "vant-ui",
"license": "MIT",
"miniprogram": "lib",
@ -16,7 +16,6 @@
"release": "sh build/release.sh",
"release:site": "vant-cli build-site && gh-pages -d site-dist --add",
"build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib",
"build:changelog": "vant-cli changelog",
"upload:weapp": "node build/upload.js",
"test": "jest",
"test:watch": "jest --watch"
@ -44,8 +43,9 @@
"@babel/plugin-transform-modules-commonjs": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@types/jest": "^27.0.2",
"@vant/cli": "^4.0.0",
"@vant/cli": "^7.0.3",
"@vant/icons": "^3.0.1",
"@vant/stylelint-config": "^1.4.2",
"gulp": "^4.0.2",
"gulp-insert": "^0.5.0",
"gulp-less": "^5.0.0",
@ -58,6 +58,7 @@
"miniprogram-api-typings": "^3.1.6",
"miniprogram-ci": "^1.6.1",
"miniprogram-simulate": "^1.4.2",
"stylelint": "13.13.1",
"ts-jest": "^27.0.7",
"tscpaths": "^0.0.9",
"typescript": "^4.4.4",
@ -67,5 +68,8 @@
"Chrome >= 53",
"ChromeAndroid >= 53",
"iOS >= 9"
]
],
"resolutions": {
"source-map": "0.7.4"
}
}

View File

@ -166,6 +166,7 @@ Page({
| close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` |
| close-on-click-overlay | 点击遮罩是否关闭菜单 | _boolean_ | `true` |
| safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | _boolean_ | `true` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Events
@ -207,7 +208,7 @@ Page({
### 外部样式类
| 类名 | 说明 |
| ------------ | -------------- |
| custom-class `v1.10.7` | 根节点样式类 |
| list-class `v1.10.7` | `actions`容器样式类 |
| 类名 | 说明 |
| ---------------------- | ------------------- |
| custom-class `v1.10.7` | 根节点样式类 |
| list-class `v1.10.7` | `actions`容器样式类 |

View File

@ -38,6 +38,10 @@ VantComponent({
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {

View File

@ -9,6 +9,7 @@
custom-class="van-action-sheet custom-class"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">

View File

@ -120,7 +120,7 @@
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| id | 标识符 | _string_ | - |
| button-id `v1.10.25`| 标识符作为原生button组件的id值 | _string_ | - |
| button-id `v1.10.25` | 标识符,作为原生 button 组件的 id 值 | _string_ | - |
| type | 按钮类型,可选值为 `primary` `info` `warning` `danger` | _string_ | `default` |
| size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` |
| color `v1.0.0` | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - |
@ -167,7 +167,8 @@
### 外部样式类
| 类名 | 说明 |
| ------------- | -------------- |
| custom-class | 根节点样式类 |
| loading-class | 加载图标样式类 |
| 类名 | 说明 |
| ------------- | ---------------------- |
| custom-class | 根节点样式类 |
| hover-class | 指定按钮按下去的样式类 |
| loading-class | 加载图标样式类 |

View File

@ -286,6 +286,7 @@ Page({
| confirm-disabled-text | 确认按钮处于禁用状态时的文字 | _string_ | `确定` |
| first-day-of-week | 设置周起始日 | _0~6_ | `0` |
| readonly `v1.9.1` | 是否为只读状态,只读状态下不能选择日期 | _boolean_ | `false` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Poppable Props

View File

@ -136,6 +136,10 @@ VantComponent({
value: 0,
},
readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
},
data: {

View File

@ -13,6 +13,7 @@
closeable="{{ showTitle || showSubtitle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:enter="onOpen"
bind:close="onClose"
bind:after-enter="onOpened"

View File

@ -210,9 +210,11 @@ Page({
| active-color | 选中状态的高亮颜色 | _string_ | `#1989fa` |
| swipeable | 是否开启手势左右滑动切换 | _boolean_ | `false` |
| closeable | 是否显示关闭图标 | _boolean_ | `true` |
| ellipsis `v1.11.7` | 是否省略过长的标题文字, 关闭后文字过长会出现横向滚动 | _boolean_ | `true` |
| show-header | 是否展示标题栏 | _boolean_ | `true` |
| close-icon | 关闭图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/icon) | _string_ | `cross` |
| field-names | 自定义 `options` 结构中的字段 | _CascaderFieldNames_ | `{ text: 'text', value: 'value', children: 'children' }` |
| use-title-slot `v1.11.3` | 是否使用自定义标题的插槽 | _boolean_ | `false` |
### CascaderOption 数据结构

View File

@ -45,6 +45,10 @@ VantComponent({
type: Boolean,
value: true,
},
ellipsis: {
type: Boolean,
value: true,
},
showHeader: {
type: Boolean,
value: true,
@ -58,6 +62,7 @@ VantComponent({
value: defaultFieldNames,
observer: 'updateFieldNames',
},
useTitleSlot: Boolean,
},
data: {
@ -189,6 +194,7 @@ VantComponent({
selected: null,
},
],
activeTab: 0,
});
},
onClose() {

View File

@ -1,7 +1,8 @@
<wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header">
<text class="van-cascader__title"><slot name="title"></slot>{{ title }}</text>
<slot name="title" wx:if="{{ useTitleSlot }}"></slot>
<text class="van-cascader__title" wx:else>{{ title }}</text>
<van-icon
wx:if="{{ closeable }}"
name="{{ closeIcon }}"
@ -18,6 +19,7 @@
color="{{ activeColor }}"
border="{{ false }}"
swipeable="{{ swipeable }}"
ellipsis="{{ ellipsis }}"
bind:click="onClickTab"
>
<van-tab

View File

@ -76,6 +76,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -187,6 +188,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -298,6 +300,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -409,6 +412,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view

View File

@ -183,6 +183,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -300,6 +301,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -544,6 +546,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -661,6 +664,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view

View File

@ -7,6 +7,7 @@ interface VantComponentInstance {
detail?: unknown,
options?: WechatMiniprogram.Component.TriggerEventOption
) => void;
setView: (value: Record<string, any>, callback?: () => void) => void;
}
export type VantComponentOptions<

View File

@ -266,6 +266,7 @@ Page({
| before-close | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action) => boolean \| Promise\<boolean\>_ | - |
| transition | 动画名称,可选值为`fade` | _string_ | `scale` |
| confirm-button-open-type | 确认按钮的微信开放能力,具体支持可参考 [微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) | _string_ | - |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### OpenType Props

View File

@ -68,6 +68,10 @@ VantComponent({
type: String,
value: 'scale',
},
rootPortal: {
type: Boolean,
value: false,
},
},
data: {

View File

@ -9,6 +9,7 @@
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view

View File

@ -254,7 +254,7 @@ Page({
| label | 输入框左侧文本 | _string_ | - |
| size | 单元格大小,可选值为 `large` | _string_ | - |
| value | 当前输入的值 | _string \| number_ | - |
| type | 可设置为任意原生类型, 如 `number` `idcard` `textarea` `digit` | _string_ | `text` |
| type | 可设置为任意原生类型, 如 `number` `idcard` `textarea` `digit` `nickname` | _string_ | `text` |
| fixed | 如果 type 为 `textarea` 且在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | _boolean_ | `false` |
| focus | 获取焦点 | _boolean_ | `false` |
| border | 是否显示内边框 | _boolean_ | `true` |
@ -309,6 +309,7 @@ Page({
| bind:click-input | 点击输入区域时触发 | - |
| bind:linechange | 输入框行数变化时调用,只对 textarea 有效 | event.detail = { height: 0, heightRpx: 0, lineCount: 0 } |
| bind:keyboardheightchange | 键盘高度发生变化的时候触发此事件 | event.detail = { height: height, duration: duration } |
| bind:nicknamereview `v1.11.5` | 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效 | event.detail = { pass, timeout } |
### InputDetail

View File

@ -66,6 +66,20 @@ VantComponent({
showClear: false,
},
watch: {
value(this: WechatMiniprogram.Component.TrivialInstance, value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger() {
this.setShowClear();
},
},
created() {
this.value = this.data.value;
this.setData({ innerValue: this.value });
@ -164,6 +178,10 @@ VantComponent({
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview(event) {
this.$emit('nicknamereview', event.detail);
},
emitChange(detail: InputDetails) {
const { extraEventParams } = this.data;
@ -200,7 +218,7 @@ VantComponent({
showClear = hasValue && trigger;
}
this.setData({ showClear });
this.setView({ showClear });
},
noop() {},

View File

@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>

View File

@ -1,13 +1,5 @@
export const commonProps: WechatMiniprogram.Component.PropertyOption = {
value: {
type: String,
observer(this: WechatMiniprogram.Component.TrivialInstance, value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
}
},
},
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,

View File

@ -67,6 +67,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -163,6 +164,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -250,6 +252,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -353,6 +356,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -446,6 +450,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -522,6 +527,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -623,6 +629,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -814,6 +821,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view

View File

@ -22,6 +22,10 @@ VantComponent({
type: String,
value: 'danger',
},
customStyle: {
type: String,
value: '',
},
},
methods: {

View File

@ -12,6 +12,7 @@
open-type="{{ openType }}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}"
custom-class="van-goods-action-button__inner custom-class"
custom-style="{{customStyle}}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"

View File

@ -144,6 +144,7 @@ Page({
| send-message-path | 会话内消息卡片点击跳转小程序路径 | _string_ | 当前分享路径 |
| send-message-img | sendMessageImg | _string_ | 截图 |
| show-message-card | 显示会话内消息卡片 | _string_ | `false` |
| custom-style `v1.11.3` | 自定义样式 | _string_ | '' |
### Events

View File

@ -13,5 +13,28 @@ export const basic = Behavior({
return new Promise((resolve) => wx.nextTick(resolve));
},
// high performance setData
setView(
this: WechatMiniprogram.Component.TrivialInstance,
data: Record<string, any>,
callback?: () => void
) {
const target: Record<string, any> = {};
let hasChange = false;
Object.keys(data).forEach((key) => {
if (data[key] !== this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});

View File

@ -23,7 +23,6 @@ export function transition(showDefaultValue: boolean) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
@ -53,75 +52,85 @@ export function transition(showDefaultValue: boolean) {
},
enter() {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.enterFinishedPromise) return;
this.enterFinishedPromise = new Promise((resolve) => {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
if (this.status === 'enter') {
return;
}
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
});
},
leave() {
if (!this.data.display) {
return;
}
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
if (!this.enterFinishedPromise) return;
this.enterFinishedPromise.then(() => {
if (!this.data.display) {
return;
}
this.$emit('leave');
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.setData({
classes: classNames.leave,
currentDuration,
});
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => this.onTransitionEnd(), currentDuration);
this.$emit('leave');
this.setData({ classes: classNames['leave-to'] });
this.setData({
classes: classNames.leave,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => {
this.onTransitionEnd();
this.enterFinishedPromise = null;
}, currentDuration);
this.setData({ classes: classNames['leave-to'] });
});
});
});
},

View File

@ -92,6 +92,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -203,6 +204,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -322,6 +324,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -429,6 +432,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -536,6 +540,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
@ -650,6 +655,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view

View File

@ -168,6 +168,7 @@ Page({
| overlay | 是否显示遮罩层 | _boolean_ | `true` |
| close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
| safe-area-inset-bottom | 是否开启底部安全区适配 | _boolean_ | `true` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Option 数据结构

View File

@ -37,6 +37,10 @@ VantComponent({
type: null,
value: 300,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {

View File

@ -11,6 +11,7 @@
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:close="onClose"
bind:click-overlay="onClickOverlay"
>

View File

@ -94,12 +94,12 @@ Page({
value: 1,
},
onChange(value) {
onChange(event) {
Toast.loading({ forbidClick: true });
setTimeout(() => {
Toast.clear();
this.setData({ value });
this.setData({ value: event.detail });
}, 500);
},
});
@ -137,7 +137,7 @@ Page({
| disable-plus | 是否禁用增加按钮 | _boolean_ | - |
| disable-minus | 是否禁用减少按钮 | _boolean_ | - |
| long-press | 是否开启长按手势 | _boolean_ | `true` |
| always-embed `v1.9.3` | 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) | _boolean_ | `false` |
| always-embed `v1.9.3` | 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) | _boolean_ | `false` |
### Events

View File

@ -161,13 +161,7 @@ VantComponent({
return;
}
let formatted = this.filter(value);
// limit max decimal length
if (isDef(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
const pair = formatted.split('.');
formatted = `${pair[0]}.${pair[1].slice(0, this.data.decimalLength)}`;
}
let formatted = this.format(value);
this.emitChange(formatted);
},

View File

@ -244,10 +244,11 @@ uploadFilePromise(fileName, chooseResult) {
| camera | 当 accept 为 `video` \| `media` 时生效,可选值为 `back` `front` | _string_ | - |
| compressed | 当 accept 为 `video` 时生效,是否压缩视频,默认为`true` | _boolean_ | - |
| max-duration | 当 accept 为 `video` \| `media` 时生效,拍摄视频最长拍摄时间,单位秒 | _number_ | `60` |
| media-type `v1.10.8` | 当 accept 为 `media` 时生效,选择的文件的文件类型,可选值为 `image` `video` | _string[]_ | `['image', 'video']` |
| media-type `v1.10.8` | 当 accept 为 `media` 时生效,选择的文件的文件类型,可选值为 `image` `video` `mix` | _string[]_ | `['image', 'video', 'mix']` |
| extension `v1.10.11` | 当 accept 为 `file` 时生效,根据文件拓展名过滤可选择文件。每一项都不能是空字符串。默认不过滤 | _string[] \| undefined_ | - |
| showmenu `v1.10.13` | 预览图片时,是否显示长按菜单 | _boolean_ | `true` |
| upload-icon | 上传区域图标,可选值见 [Icon 组件](#/icon) | _string_ | `plus` |
| referrer-policy `v1.11.6` | 当 accept 为 video 时生效,具体用法参考 [微信官方 - 媒体组件 / video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) | string | `no-referrer` |
#### accept 的合法值

View File

@ -1,7 +1,7 @@
import { VantComponent } from '../common/component';
import { isImageFile, chooseFile, isVideoFile, File } from './utils';
import { imageProps, videoProps, mediaProps, messageFileProps } from './shared';
import { isBoolean, isPromise } from '../common/validator';
import { imageProps, mediaProps, messageFileProps, videoProps } from './shared';
import { chooseFile, File, isImageFile, isVideoFile } from './utils';
VantComponent({
props: {

View File

@ -29,6 +29,7 @@
poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}"

View File

@ -32,6 +32,10 @@ export const videoProps = {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
@ -42,7 +46,7 @@ export const mediaProps = {
},
mediaType: {
type: Array,
value: ['image', 'video'],
value: ['image', 'video', 'mix'],
},
maxDuration: {
type: Number,

View File

@ -73,9 +73,10 @@ function formatVideo(
function formatMedia(res: WechatMiniprogram.ChooseMediaSuccessCallbackResult) {
return res.tempFiles.map((item) => ({
...pickExclude(item, ['fileType', 'thumbTempFilePath', 'tempFilePath']),
type: res.type,
type: item.fileType,
url: item.tempFilePath,
thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath,
thumb:
item.fileType === 'video' ? item.thumbTempFilePath : item.tempFilePath,
}));
}

7
rsbuild.config.ts Normal file
View File

@ -0,0 +1,7 @@
export default {
server: {
proxy: {
'/vant/v2': 'https://vant-ui.github.io',
},
},
};

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