mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
Compare commits
179 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e5af691c4c | ||
|
c6b4004893 | ||
|
db1c0ce662 | ||
|
1a8351387a | ||
|
2543148507 | ||
|
2266cbe262 | ||
|
809bc84d1e | ||
|
e5f462263b | ||
|
22f39e86b9 | ||
|
ff982f6cd0 | ||
|
178795253f | ||
|
443e78daec | ||
|
07dfcafb26 | ||
|
ebba3b14a1 | ||
|
04c8783b1d | ||
|
c38c931325 | ||
|
ab45d8011c | ||
|
8953dd3ed9 | ||
|
2680fedace | ||
|
68be39fea2 | ||
|
979fc92bdc | ||
|
348c3103b7 | ||
|
50da9f87eb | ||
|
fc1ad93c57 | ||
|
902579a94a | ||
|
cce61c26af | ||
|
5b9f52b7ef | ||
|
aac785bc2c | ||
|
4db5b132d1 | ||
|
c7e8ab5ef3 | ||
|
9130ebf59c | ||
|
cdb692fbec | ||
|
b9f88ec64a | ||
|
c0b7537da9 | ||
|
c4b3609370 | ||
|
040416bdb7 | ||
|
7c0c9e43f7 | ||
|
ff8fe1cb69 | ||
|
628008efb3 | ||
|
3f8cc449d2 | ||
|
e2b031c436 | ||
|
d1f505b8e8 | ||
|
19083a327c | ||
|
f2ff0e7b48 | ||
|
d0610c09ac | ||
|
c3ae27b4b0 | ||
|
d869a8149f | ||
|
864a890e83 | ||
|
1d0600cece | ||
|
5b7dc9a4ab | ||
|
eeea4a8434 | ||
|
f98cf75027 | ||
|
3e6e157c6a | ||
|
8af9924056 | ||
|
05ec5e2526 | ||
|
7d438e2843 | ||
|
3e9cdcfd7c | ||
|
36d0add734 | ||
|
27979cf894 | ||
|
98874a155c | ||
|
14b97ead79 | ||
|
b936371007 | ||
|
1939b76a04 | ||
|
be99bd3bd3 | ||
|
bc649cff58 | ||
|
42447bb87c | ||
|
f330cf2a34 | ||
|
7423e18ae3 | ||
|
8ce21a6446 | ||
|
18ffa1891d | ||
|
6dd89841a8 | ||
|
3da43a131c | ||
|
3e06aa4e89 | ||
|
fd41bd823a | ||
|
b9dea4fd16 | ||
|
de8d8359f3 | ||
|
48a0bf0351 | ||
|
511adf7f5d | ||
|
d692b708af | ||
|
610ce18859 | ||
|
6d6d6d736b | ||
|
fd95792040 | ||
|
ea8f92f919 | ||
|
88a36b5647 | ||
|
f975d2b37d | ||
|
589be648f2 | ||
|
713f694aa0 | ||
|
c99f464360 | ||
|
e0abf6effc | ||
|
78c518bae8 | ||
|
9ead748d91 | ||
|
8021e7cdfd | ||
|
dec405d770 | ||
|
e67ff09e37 | ||
|
4756994212 | ||
|
799a06379d | ||
|
917ab22907 | ||
|
7498ed12c3 | ||
|
f197c5f3c3 | ||
|
f26de0cbb0 | ||
|
8309c27297 | ||
|
fa04172e5b | ||
|
b005b41c4e | ||
|
2c7629fe07 | ||
|
bc3d307c4d | ||
|
a3117538b3 | ||
|
d72580fe7d | ||
|
3d1d27641b | ||
|
22acb8ddbc | ||
|
35d8346647 | ||
|
a232ec525f | ||
|
d235ae6574 | ||
|
b01a768557 | ||
|
bcdd2961be | ||
|
8fba87ee74 | ||
|
c5ffb225ba | ||
|
ec6d90fcc5 | ||
|
35b199f9f6 | ||
|
1ad122b9cf | ||
|
e8ed007d89 | ||
|
7decaed8e4 | ||
|
8697c56b85 | ||
|
ba927da0ea | ||
|
0d6d54d199 | ||
|
ffb1fe6053 | ||
|
a0b0bd163d | ||
|
cf682f6634 | ||
|
31d255d57e | ||
|
344b1b0f69 | ||
|
f1ad8d4b56 | ||
|
51bd751453 | ||
|
4b86663562 | ||
|
97af57cee9 | ||
|
53e4a0d3f9 | ||
|
10795bf325 | ||
|
a6005980c9 | ||
|
a140117e8b | ||
|
8715142079 | ||
|
9f1a52ea15 | ||
|
9c57499824 | ||
|
6dd828ce90 | ||
|
4ccb1eeb67 | ||
|
09bdbccb93 | ||
|
57859ac402 | ||
|
6234035799 | ||
|
ccbbe1e9f6 | ||
|
08f3a41a3e | ||
|
767da88bc6 | ||
|
2796a2b0fa | ||
|
64efb4d204 | ||
|
33858004a1 | ||
|
8102e79531 | ||
|
eb56755fd7 | ||
|
9cbc1662a8 | ||
|
f72584bed2 | ||
|
cbc6cc88b1 | ||
|
b54f78328d | ||
|
629603e7b0 | ||
|
a95769652b | ||
|
31b17e910b | ||
|
0e285b130a | ||
|
914c659d56 | ||
|
0b02eeb4c3 | ||
|
d1be0b3c8b | ||
|
8f28e6ae42 | ||
|
071650a37b | ||
|
9271152ec2 | ||
|
33a7e55a71 | ||
|
e0df0181f2 | ||
|
747b30597a | ||
|
9e6832bf85 | ||
|
a1a1af37f1 | ||
|
5d8ebb2e45 | ||
|
4a3dbff38b | ||
|
05f6159df8 | ||
|
aa445fddb7 | ||
|
466b9b5504 | ||
|
7160828cf1 | ||
|
e46d11f837 |
@ -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
10
.github/pr-labeler.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"change: feat":
|
||||
- "/^(feat|types|style)/"
|
||||
"change: fix":
|
||||
- "/^fix/"
|
||||
"change: perf":
|
||||
- "/^perf/"
|
||||
"change: breaking":
|
||||
- "/^breaking change/"
|
||||
"change: docs":
|
||||
- "/^docs/"
|
15
.github/workflows/deploy-site.yml
vendored
15
.github/workflows/deploy-site.yml
vendored
@ -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
20
.github/workflows/pr-label.yaml
vendored
Normal 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
|
11
.github/workflows/release-tag.yml
vendored
11
.github/workflows/release-tag.yml
vendored
@ -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) 了解所有更新。
|
||||
|
20
.github/workflows/sync-gitee.yml
vendored
20
.github/workflows/sync-gitee.yml
vendored
@ -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
|
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -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
|
||||
|
26
README.md
26
README.md
@ -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>
|
||||
|
||||
🌈 <a href="https://youzan.github.io/vant-weapp">文档网站(GitHub)</a>
|
||||
🔥 <a href="https://vant-ui.github.io/vant-weapp/">文档网站(GitHub)</a>
|
||||
|
||||
🚀 <a href="https://github.com/vant-ui/vant" target="_blank">Vue 版</a>
|
||||
</p>
|
||||
@ -24,11 +24,11 @@
|
||||
|
||||
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)。
|
||||
|
||||
## 预览
|
||||
|
||||
扫描下方小程序二维码,体验组件库示例:
|
||||
扫描下方小程序二维码,体验组件库示例。注意:因微信审核机制限制,目前示例小程序不是最新版本,可以 clone 代码到本地开发工具预览
|
||||
|
||||
<img src="https://img.yzcdn.cn/vant-weapp/qrcode-201808101114.jpg" width="200" height="200" style="margin-top: 10px;" >
|
||||
|
||||
@ -99,22 +99,24 @@ 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)
|
||||
|
||||
## 核心团队
|
||||
|
||||
以下是 Vant 和 Vant Weapp 的核心贡献者们:
|
||||
|
||||
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) |
|
||||
| :-: | :-: | :-: | :-: | :-: |
|
||||
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) |
|
||||
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) | [](https://github.com/nemo-shen/) |
|
||||
| :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) | [nemo-shen](https://github.com/nemo-shen/) |
|
||||
|
||||
| [](https://github.com/nemo-shen/) | [](https://github.com/Lindysen/) | [](https://github.com/JakeLaoyu/) | [](https://github.com/landluck/) | [](https://github.com/wjw-gavin/) |
|
||||
| :-: | :-: | :-: | :-: | :-: |
|
||||
| [nemo-shen](https://github.com/nemo-shen/) | [Lindysen](https://github.com/Lindysen/) | [JakeLaoyu](https://github.com/JakeLaoyu/) | [landluck](https://github.com/landluck/) | [wjw-gavin](https://github.com/wjw-gavin/) |
|
||||
| [](https://github.com/Lindysen/) | [](https://github.com/JakeLaoyu/) | [](https://github.com/landluck/) | [](https://github.com/wjw-gavin/) | [](https://github.com/inottn/) | [](https://github.com/zhousg/) |
|
||||
| :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [Lindysen](https://github.com/Lindysen/) | [JakeLaoyu](https://github.com/JakeLaoyu/) | [landluck](https://github.com/landluck/) | [wjw-gavin](https://github.com/wjw-gavin/) | [inottn](https://github.com/inottn/) | [zhousg](https://github.com/zhousg/) |
|
||||
|
||||
## 贡献者们
|
||||
|
||||
|
@ -28,7 +28,4 @@ then
|
||||
else
|
||||
npm publish
|
||||
fi
|
||||
|
||||
# changelog
|
||||
vant-cli changelog
|
||||
fi
|
||||
|
4
dist/action-sheet/index.js
vendored
4
dist/action-sheet/index.js
vendored
@ -36,6 +36,10 @@ VantComponent({
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onSelect(event) {
|
||||
|
1
dist/action-sheet/index.wxml
vendored
1
dist/action-sheet/index.wxml
vendored
@ -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">
|
||||
|
4
dist/button/index.wxml
vendored
4
dist/button/index.wxml
vendored
@ -2,7 +2,7 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<button
|
||||
id="{{ id }}"
|
||||
id="{{ id || buttonId }}"
|
||||
data-detail="{{ dataset }}"
|
||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
|
||||
hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
|
||||
@ -22,6 +22,8 @@
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
|
2
dist/calendar/calendar.wxml
vendored
2
dist/calendar/calendar.wxml
vendored
@ -1,3 +1,5 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<view class="van-calendar">
|
||||
<header
|
||||
title="{{ title }}"
|
||||
|
22
dist/calendar/index.js
vendored
22
dist/calendar/index.js
vendored
@ -40,6 +40,7 @@ VantComponent({
|
||||
},
|
||||
defaultDate: {
|
||||
type: null,
|
||||
value: getToday().getTime(),
|
||||
observer(val) {
|
||||
this.setData({ currentDate: val });
|
||||
this.scrollIntoView();
|
||||
@ -112,12 +113,24 @@ VantComponent({
|
||||
value: 0,
|
||||
},
|
||||
readonly: Boolean,
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
subtitle: '',
|
||||
currentDate: null,
|
||||
scrollIntoView: '',
|
||||
},
|
||||
watch: {
|
||||
minDate() {
|
||||
this.initRect();
|
||||
},
|
||||
maxDate() {
|
||||
this.initRect();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.setData({
|
||||
currentDate: this.getInitialDate(this.data.defaultDate),
|
||||
@ -131,7 +144,7 @@ VantComponent({
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
this.setData({ currentDate: this.getInitialDate() });
|
||||
this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
|
||||
this.scrollIntoView();
|
||||
},
|
||||
initRect() {
|
||||
@ -164,13 +177,16 @@ VantComponent({
|
||||
},
|
||||
getInitialDate(defaultDate = null) {
|
||||
const { type, minDate, maxDate, allowSameDay } = this.data;
|
||||
if (!defaultDate)
|
||||
return [];
|
||||
const now = getToday().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
defaultDate = [];
|
||||
}
|
||||
const [startDay, endDay] = defaultDate || [];
|
||||
const start = this.limitDateRange(startDay || now, minDate, getPrevDay(new Date(maxDate)).getTime());
|
||||
const startDate = getTime(startDay || now);
|
||||
const start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : getPrevDay(new Date(maxDate)).getTime());
|
||||
const date = getTime(endDay || now);
|
||||
const end = this.limitDateRange(date, allowSameDay ? date : getNextDay(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
@ -189,6 +205,8 @@ VantComponent({
|
||||
scrollIntoView() {
|
||||
requestAnimationFrame(() => {
|
||||
const { currentDate, type, show, poppable, minDate, maxDate } = this.data;
|
||||
if (!currentDate)
|
||||
return;
|
||||
// @ts-ignore
|
||||
const targetDate = type === 'single' ? currentDate : currentDate[0];
|
||||
const displayed = show || !poppable;
|
||||
|
1
dist/calendar/index.wxml
vendored
1
dist/calendar/index.wxml
vendored
@ -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"
|
||||
|
2
dist/calendar/index.wxss
vendored
2
dist/calendar/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
44
dist/cascader/index.js
vendored
44
dist/cascader/index.js
vendored
@ -15,7 +15,6 @@ VantComponent({
|
||||
title: String,
|
||||
value: {
|
||||
type: String,
|
||||
observer: 'updateValue',
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
@ -28,7 +27,6 @@ VantComponent({
|
||||
options: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: 'updateOptions',
|
||||
},
|
||||
swipeable: {
|
||||
type: Boolean,
|
||||
@ -51,6 +49,7 @@ VantComponent({
|
||||
value: defaultFieldNames,
|
||||
observer: 'updateFieldNames',
|
||||
},
|
||||
useTitleSlot: Boolean,
|
||||
},
|
||||
data: {
|
||||
tabs: [],
|
||||
@ -58,15 +57,20 @@ VantComponent({
|
||||
textKey: FieldName.TEXT,
|
||||
valueKey: FieldName.VALUE,
|
||||
childrenKey: FieldName.CHILDREN,
|
||||
innerValue: '',
|
||||
},
|
||||
watch: {
|
||||
options() {
|
||||
this.updateTabs();
|
||||
},
|
||||
value(newVal) {
|
||||
this.updateValue(newVal);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.updateTabs();
|
||||
},
|
||||
methods: {
|
||||
updateOptions(val, oldVal) {
|
||||
const isAsync = !!(val.length && oldVal.length);
|
||||
this.updateTabs(isAsync);
|
||||
},
|
||||
updateValue(val) {
|
||||
if (val !== undefined) {
|
||||
const values = this.data.tabs.map((tab) => tab.selected && tab.selected[this.data.valueKey]);
|
||||
@ -74,6 +78,7 @@ VantComponent({
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.innerValue = val;
|
||||
this.updateTabs();
|
||||
},
|
||||
updateFieldNames() {
|
||||
@ -98,10 +103,14 @@ VantComponent({
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTabs(isAsync = false) {
|
||||
const { options, value } = this.data;
|
||||
if (value !== undefined) {
|
||||
const selectedOptions = this.getSelectedOptionsByValue(options, value);
|
||||
updateTabs() {
|
||||
const { options } = this.data;
|
||||
const { innerValue } = this;
|
||||
if (!options.length) {
|
||||
return;
|
||||
}
|
||||
if (innerValue !== undefined) {
|
||||
const selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
|
||||
if (selectedOptions) {
|
||||
let optionsCursor = options;
|
||||
const tabs = selectedOptions.map((option) => {
|
||||
@ -132,16 +141,6 @@ VantComponent({
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 异步更新
|
||||
if (isAsync) {
|
||||
const { tabs } = this.data;
|
||||
tabs[tabs.length - 1].options =
|
||||
options[options.length - 1][this.data.childrenKey];
|
||||
this.setData({
|
||||
tabs,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
tabs: [
|
||||
{
|
||||
@ -149,6 +148,7 @@ VantComponent({
|
||||
selected: null,
|
||||
},
|
||||
],
|
||||
activeTab: 0,
|
||||
});
|
||||
},
|
||||
onClose() {
|
||||
@ -194,11 +194,13 @@ VantComponent({
|
||||
tabs,
|
||||
});
|
||||
const selectedOptions = tabs.map((tab) => tab.selected).filter(Boolean);
|
||||
const value = option[valueKey];
|
||||
const params = {
|
||||
value: option[valueKey],
|
||||
value,
|
||||
tabIndex,
|
||||
selectedOptions,
|
||||
};
|
||||
this.innerValue = value;
|
||||
this.$emit('change', params);
|
||||
if (!option[childrenKey]) {
|
||||
this.$emit('finish', params);
|
||||
|
9
dist/cascader/index.wxml
vendored
9
dist/cascader/index.wxml
vendored
@ -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 }}"
|
||||
@ -37,14 +38,14 @@
|
||||
wx:for="{{ tab.options }}"
|
||||
wx:for-item="option"
|
||||
wx:key="index"
|
||||
class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}"
|
||||
style="{{ utils.optionStyle({ tab, textKey, option, activeColor }) }}"
|
||||
class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
|
||||
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
|
||||
data-option="{{ option }}"
|
||||
data-tab-index="{{ tabIndex }}"
|
||||
bind:tap="onSelect"
|
||||
>
|
||||
<text>{{ option[textKey] }}</text>
|
||||
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
|
||||
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 暂不支持 -->
|
||||
|
10
dist/cascader/index.wxs
vendored
10
dist/cascader/index.wxs
vendored
@ -1,16 +1,16 @@
|
||||
var utils = require('../wxs/utils.wxs');
|
||||
var style = require('../wxs/style.wxs');
|
||||
|
||||
function isSelected(tab, textKey, option) {
|
||||
return tab.selected && tab.selected[textKey] === option[textKey]
|
||||
function isSelected(tab, valueKey, option) {
|
||||
return tab.selected && tab.selected[valueKey] === option[valueKey]
|
||||
}
|
||||
|
||||
function optionClass(tab, textKey, option) {
|
||||
return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled })
|
||||
function optionClass(tab, valueKey, option) {
|
||||
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
|
||||
}
|
||||
|
||||
function optionStyle(data) {
|
||||
var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
|
||||
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
|
||||
return style({
|
||||
color
|
||||
});
|
||||
|
4
dist/circle/index.js
vendored
4
dist/circle/index.js
vendored
@ -93,6 +93,8 @@ VantComponent({
|
||||
const { color, size } = this.data;
|
||||
if (isObj(color)) {
|
||||
return this.getContext().then((context) => {
|
||||
if (!context)
|
||||
return;
|
||||
const LinearColor = context.createLinearGradient(size, 0, 0, 0);
|
||||
Object.keys(color)
|
||||
.sort((a, b) => parseFloat(a) - parseFloat(b))
|
||||
@ -134,6 +136,8 @@ VantComponent({
|
||||
drawCircle(currentValue) {
|
||||
const { size } = this.data;
|
||||
this.getContext().then((context) => {
|
||||
if (!context)
|
||||
return;
|
||||
context.clearRect(0, 0, size, size);
|
||||
this.renderLayerCircle(context);
|
||||
const formatValue = format(currentValue);
|
||||
|
4
dist/common/utils.d.ts
vendored
4
dist/common/utils.d.ts
vendored
@ -14,4 +14,8 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
|
||||
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
|
||||
export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
|
||||
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>;
|
||||
export declare function addNumber(num1: any, num2: any): number;
|
||||
export declare const clamp: (num: any, min: any, max: any) => number;
|
||||
export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;
|
||||
export declare const isPC: boolean;
|
||||
export declare const isWxWork: boolean;
|
||||
|
12
dist/common/utils.js
vendored
12
dist/common/utils.js
vendored
@ -1,5 +1,5 @@
|
||||
import { isDef, isNumber, isPlainObject, isPromise } from './validator';
|
||||
import { canIUseGroupSetData, canIUseNextTick } from './version';
|
||||
import { canIUseGroupSetData, canIUseNextTick, getSystemInfoSync, } from './version';
|
||||
export { isDef } from './validator';
|
||||
export { getSystemInfoSync } from './version';
|
||||
export function range(num, min, max) {
|
||||
@ -70,7 +70,17 @@ export function toPromise(promiseLike) {
|
||||
}
|
||||
return Promise.resolve(promiseLike);
|
||||
}
|
||||
// 浮点数精度处理
|
||||
export function addNumber(num1, num2) {
|
||||
const cardinal = Math.pow(10, 10);
|
||||
return Math.round((num1 + num2) * cardinal) / cardinal;
|
||||
}
|
||||
// 限制value在[min, max]之间
|
||||
export const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
||||
export function getCurrentPage() {
|
||||
const pages = getCurrentPages();
|
||||
return pages[pages.length - 1];
|
||||
}
|
||||
export const isPC = ['mac', 'windows'].includes(getSystemInfoSync().platform);
|
||||
// 是否企业微信
|
||||
export const isWxWork = getSystemInfoSync().environment === 'wxwork';
|
||||
|
8
dist/common/version.d.ts
vendored
8
dist/common/version.d.ts
vendored
@ -1,5 +1,10 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
export declare function getSystemInfoSync(): WechatMiniprogram.SystemInfo;
|
||||
interface WxWorkSystemInfo extends WechatMiniprogram.SystemInfo {
|
||||
environment?: 'wxwork';
|
||||
}
|
||||
interface SystemInfo extends WxWorkSystemInfo, WechatMiniprogram.SystemInfo {
|
||||
}
|
||||
export declare function getSystemInfoSync(): SystemInfo;
|
||||
export declare function canIUseModel(): boolean;
|
||||
export declare function canIUseFormFieldButton(): boolean;
|
||||
export declare function canIUseAnimate(): boolean;
|
||||
@ -7,3 +12,4 @@ export declare function canIUseGroupSetData(): boolean;
|
||||
export declare function canIUseNextTick(): boolean;
|
||||
export declare function canIUseCanvas2d(): boolean;
|
||||
export declare function canIUseGetUserProfile(): boolean;
|
||||
export {};
|
||||
|
1
dist/definitions/index.d.ts
vendored
1
dist/definitions/index.d.ts
vendored
@ -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;
|
||||
|
10
dist/dialog/index.js
vendored
10
dist/dialog/index.js
vendored
@ -4,6 +4,7 @@ import { GRAY, RED } from '../common/color';
|
||||
import { toPromise } from '../common/utils';
|
||||
VantComponent({
|
||||
mixins: [button],
|
||||
classes: ['cancle-button-class', 'confirm-button-class'],
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
@ -17,14 +18,17 @@ VantComponent({
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
useSlot: Boolean,
|
||||
confirmButtonId: String,
|
||||
className: String,
|
||||
customStyle: String,
|
||||
asyncClose: Boolean,
|
||||
messageAlign: String,
|
||||
beforeClose: null,
|
||||
overlayStyle: String,
|
||||
useSlot: Boolean,
|
||||
useTitleSlot: Boolean,
|
||||
useConfirmButtonSlot: Boolean,
|
||||
useCancelButtonSlot: Boolean,
|
||||
showCancelButton: Boolean,
|
||||
closeOnClickOverlay: Boolean,
|
||||
confirmButtonOpenType: String,
|
||||
@ -61,6 +65,10 @@ VantComponent({
|
||||
type: String,
|
||||
value: 'scale',
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
loading: {
|
||||
|
94
dist/dialog/index.wxml
vendored
94
dist/dialog/index.wxml
vendored
@ -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
|
||||
@ -33,7 +34,7 @@
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel"
|
||||
custom-class="van-dialog__cancel cancle-button-class"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
@ -44,9 +45,9 @@
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
custom-class="van-dialog__confirm confirm-button-class"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
|
||||
button-id="{{ confirmButtonId }}"
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
@ -56,7 +57,8 @@
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
|
||||
bind:click="onConfirm"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
@ -70,44 +72,54 @@
|
||||
</van-goods-action>
|
||||
|
||||
<view wx:elif="{{ showCancelButton || showConfirmButton }}" class="van-hairline--top van-dialog__footer">
|
||||
<van-button
|
||||
wx:if="{{ showCancelButton }}"
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
{{ cancelButtonText }}
|
||||
</van-button>
|
||||
<van-button
|
||||
wx:if="{{ showConfirmButton }}"
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
<block wx:if="{{ showCancelButton }}">
|
||||
<slot wx:if="{{ useCancelButtonSlot }}" name="cancel-button" />
|
||||
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
<van-button
|
||||
wx:else
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel cancle-button-class"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
{{ cancelButtonText }}
|
||||
</van-button>
|
||||
</block>
|
||||
|
||||
bind:click="onConfirm"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
>
|
||||
{{ confirmButtonText }}
|
||||
</van-button>
|
||||
<block wx:if="{{ showConfirmButton }}">
|
||||
<slot wx:if="{{ useConfirmButtonSlot }}" name="confirm-button" />
|
||||
|
||||
<van-button
|
||||
wx:else
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm confirm-button-class"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
button-id="{{ confirmButtonId }}"
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
|
||||
bind:click="onConfirm"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
>
|
||||
{{ confirmButtonText }}
|
||||
</van-button>
|
||||
</block>
|
||||
</view>
|
||||
</van-popup>
|
||||
|
42
dist/field/index.js
vendored
42
dist/field/index.js
vendored
@ -31,16 +31,36 @@ 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 });
|
||||
},
|
||||
methods: {
|
||||
formatValue(value) {
|
||||
const { maxlength } = this.data;
|
||||
if (maxlength !== -1 && value.length > maxlength) {
|
||||
return value.slice(0, maxlength);
|
||||
}
|
||||
return value;
|
||||
},
|
||||
onInput(event) {
|
||||
const { value = '' } = event.detail || {};
|
||||
this.value = value;
|
||||
const formatValue = this.formatValue(value);
|
||||
this.value = formatValue;
|
||||
this.setShowClear();
|
||||
this.emitChange(event.detail);
|
||||
return this.emitChange(Object.assign(Object.assign({}, event.detail), { value: formatValue }));
|
||||
},
|
||||
onFocus(event) {
|
||||
this.focused = true;
|
||||
@ -87,14 +107,20 @@ 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 });
|
||||
nextTick(() => {
|
||||
const data = extraEventParams ? detail : detail.value;
|
||||
this.$emit('input', data);
|
||||
this.$emit('change', data);
|
||||
});
|
||||
let result;
|
||||
const data = extraEventParams
|
||||
? Object.assign(Object.assign({}, detail), { callback: (data) => {
|
||||
result = data;
|
||||
} }) : detail.value;
|
||||
this.$emit('input', data);
|
||||
this.$emit('change', data);
|
||||
return result;
|
||||
},
|
||||
setShowClear() {
|
||||
const { clearable, readonly, clearTrigger } = this.data;
|
||||
@ -105,7 +131,7 @@ VantComponent({
|
||||
const trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
|
||||
showClear = hasValue && trigger;
|
||||
}
|
||||
this.setData({ showClear });
|
||||
this.setView({ showClear });
|
||||
},
|
||||
noop() { },
|
||||
},
|
||||
|
14
dist/field/index.wxml
vendored
14
dist/field/index.wxml
vendored
@ -13,12 +13,12 @@
|
||||
title-style="margin-right: 12px;"
|
||||
custom-style="{{ customStyle }}"
|
||||
arrow-direction="{{ arrowDirection }}"
|
||||
custom-class="van-field"
|
||||
custom-class="custom-class van-field"
|
||||
>
|
||||
<slot name="left-icon" slot="icon" />
|
||||
<view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
<label for="{{ name }}" wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
{{ label }}
|
||||
</view>
|
||||
</label>
|
||||
<slot wx:else name="label" slot="title" />
|
||||
<view class="{{ utils.bem('field__body', [type]) }}">
|
||||
<view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
|
||||
@ -47,10 +47,10 @@
|
||||
<slot name="button" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<label for="{{ name }}" wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
|
||||
</view>
|
||||
<view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
</label>
|
||||
<label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
{{ errorMessage }}
|
||||
</view>
|
||||
</label>
|
||||
</van-cell>
|
||||
|
2
dist/field/index.wxss
vendored
2
dist/field/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-field{--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:var(--field-label-color,#646566)}.van-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{align-items:center;display:flex}.van-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.van-field__control:empty+.van-field__control{display:block}.van-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,#323233);display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.van-field__control:empty{display:none}.van-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.van-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{color:var(--field-clear-icon-color,#c8c9cc);font-size:var(--field-clear-icon-size,16px)}.van-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{color:var(--field-error-message-color,#ee0a24);font-size:var(--field-error-message-text-font-size,12px);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.van-field__word-num{display:inline}.van-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
|
||||
@import '../common/index.wxss';.van-field{--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:var(--field-label-color,#646566)}.van-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{align-items:center;display:flex}.van-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.van-field__control:empty+.van-field__control{display:block}.van-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,#323233);display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.van-field__control:empty{display:none}.van-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.van-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{color:var(--field-clear-icon-color,#c8c9cc);font-size:var(--field-clear-icon-size,16px)}.van-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.van-field__word-num{display:inline}.van-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
|
3
dist/field/input.wxml
vendored
3
dist/field/input.wxml
vendored
@ -1,4 +1,6 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<input
|
||||
id="{{ name }}"
|
||||
class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
|
||||
type="{{ type }}"
|
||||
focus="{{ focus }}"
|
||||
@ -25,4 +27,5 @@
|
||||
bindfocus="onFocus"
|
||||
bindconfirm="onConfirm"
|
||||
bindkeyboardheightchange="onKeyboardHeightChange"
|
||||
bindnicknamereview="onBindNicknameReview"
|
||||
/>
|
||||
|
10
dist/field/props.js
vendored
10
dist/field/props.js
vendored
@ -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,
|
||||
|
3
dist/field/textarea.wxml
vendored
3
dist/field/textarea.wxml
vendored
@ -1,4 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<textarea
|
||||
id="{{ name }}"
|
||||
class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
|
||||
fixed="{{ fixed }}"
|
||||
focus="{{ focus }}"
|
||||
|
8
dist/goods-action-button/index.js
vendored
8
dist/goods-action-button/index.js
vendored
@ -8,6 +8,10 @@ VantComponent({
|
||||
props: {
|
||||
text: String,
|
||||
color: String,
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal',
|
||||
},
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
plain: Boolean,
|
||||
@ -15,6 +19,10 @@ VantComponent({
|
||||
type: String,
|
||||
value: 'danger',
|
||||
},
|
||||
customStyle: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClick(event) {
|
||||
|
7
dist/goods-action-button/index.wxml
vendored
7
dist/goods-action-button/index.wxml
vendored
@ -1,15 +1,18 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<van-button
|
||||
id="{{ id }}"
|
||||
button-id="{{ buttonId }}"
|
||||
lang="{{ lang }}"
|
||||
type="{{ type }}"
|
||||
size="{{ size }}"
|
||||
color="{{ color }}"
|
||||
plain="{{ plain }}"
|
||||
loading="{{ loading }}"
|
||||
disabled="{{ disabled }}"
|
||||
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="van-goods-action-button__inner custom-class"
|
||||
custom-style="{{customStyle}}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
@ -22,6 +25,8 @@
|
||||
bindcontact="onContact"
|
||||
bindopensetting="onOpenSetting"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
>
|
||||
|
3
dist/goods-action-icon/index.js
vendored
3
dist/goods-action-icon/index.js
vendored
@ -2,13 +2,14 @@ import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
import { link } from '../mixins/link';
|
||||
VantComponent({
|
||||
classes: ['icon-class', 'text-class'],
|
||||
classes: ['icon-class', 'text-class', 'info-class'],
|
||||
mixins: [link, button],
|
||||
props: {
|
||||
text: String,
|
||||
dot: Boolean,
|
||||
info: String,
|
||||
icon: String,
|
||||
size: String,
|
||||
color: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
|
6
dist/goods-action-icon/index.wxml
vendored
6
dist/goods-action-icon/index.wxml
vendored
@ -27,11 +27,15 @@
|
||||
name="{{ icon }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
size="{{ size }}"
|
||||
color="{{ color }}"
|
||||
class-prefix="{{ classPrefix }}"
|
||||
class="van-goods-action-icon__icon"
|
||||
custom-class="icon-class"
|
||||
info-class="info-class"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<view wx:else>
|
||||
<slot name="icon" />
|
||||
</view>
|
||||
<text class="text-class">{{ text }}</text>
|
||||
</van-button>
|
||||
|
1
dist/icon/index.js
vendored
1
dist/icon/index.js
vendored
@ -1,5 +1,6 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: ['info-class'],
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
|
2
dist/icon/index.wxml
vendored
2
dist/icon/index.wxml
vendored
@ -9,7 +9,7 @@
|
||||
wx:if="{{ info !== null || dot }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
custom-class="van-icon__info"
|
||||
custom-class="van-icon__info info-class"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ computed.isImage(name) }}"
|
||||
|
4
dist/icon/index.wxs
vendored
4
dist/icon/index.wxs
vendored
@ -9,6 +9,10 @@ function isImage(name) {
|
||||
function rootClass(data) {
|
||||
var classes = ['custom-class'];
|
||||
|
||||
if (data.classPrefix !== 'van-icon') {
|
||||
classes.push('van-icon--custom')
|
||||
}
|
||||
|
||||
if (data.classPrefix != null) {
|
||||
classes.push(data.classPrefix);
|
||||
}
|
||||
|
2
dist/icon/index.wxss
vendored
2
dist/icon/index.wxss
vendored
File diff suppressed because one or more lines are too long
15
dist/mixins/basic.js
vendored
15
dist/mixins/basic.js
vendored
@ -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();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
7
dist/mixins/button.js
vendored
7
dist/mixins/button.js
vendored
@ -3,6 +3,7 @@ export const button = Behavior({
|
||||
externalClasses: ['hover-class'],
|
||||
properties: {
|
||||
id: String,
|
||||
buttonId: String,
|
||||
lang: String,
|
||||
businessId: Number,
|
||||
sessionFrom: String,
|
||||
@ -28,6 +29,9 @@ export const button = Behavior({
|
||||
onGetPhoneNumber(event) {
|
||||
this.triggerEvent('getphonenumber', event.detail);
|
||||
},
|
||||
onGetRealTimePhoneNumber(event) {
|
||||
this.triggerEvent('getrealtimephonenumber', event.detail);
|
||||
},
|
||||
onError(event) {
|
||||
this.triggerEvent('error', event.detail);
|
||||
},
|
||||
@ -37,6 +41,9 @@ export const button = Behavior({
|
||||
onOpenSetting(event) {
|
||||
this.triggerEvent('opensetting', event.detail);
|
||||
},
|
||||
onAgreePrivacyAuthorization(event) {
|
||||
this.triggerEvent('agreeprivacyauthorization', event.detail);
|
||||
},
|
||||
onChooseAvatar(event) {
|
||||
this.triggerEvent('chooseavatar', event.detail);
|
||||
},
|
||||
|
83
dist/mixins/transition.js
vendored
83
dist/mixins/transition.js
vendored
@ -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'] });
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
2
dist/notice-bar/index.js
vendored
2
dist/notice-bar/index.js
vendored
@ -103,7 +103,7 @@ VantComponent({
|
||||
});
|
||||
this.timer = setTimeout(() => {
|
||||
this.scroll();
|
||||
}, this.duration);
|
||||
}, this.duration + this.data.delay);
|
||||
},
|
||||
onClickIcon(event) {
|
||||
if (this.data.mode === 'closeable') {
|
||||
|
2
dist/popup/popup.wxml
vendored
2
dist/popup/popup.wxml
vendored
@ -1,3 +1,5 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<view
|
||||
wx:if="{{ inited }}"
|
||||
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
|
||||
|
4
dist/search/index.js
vendored
4
dist/search/index.js
vendored
@ -53,6 +53,10 @@ VantComponent({
|
||||
type: String,
|
||||
value: 'clear',
|
||||
},
|
||||
cursorSpacing: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onChange(event) {
|
||||
|
1
dist/search/index.wxml
vendored
1
dist/search/index.wxml
vendored
@ -28,6 +28,7 @@
|
||||
input-class="input-class"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
custom-style="padding: 5px 10px 5px 0; background-color: transparent;"
|
||||
bind:blur="onBlur"
|
||||
bind:focus="onFocus"
|
||||
|
4
dist/share-sheet/index.js
vendored
4
dist/share-sheet/index.js
vendored
@ -36,6 +36,10 @@ VantComponent({
|
||||
type: null,
|
||||
value: 300,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClickOverlay() {
|
||||
|
1
dist/share-sheet/index.wxml
vendored
1
dist/share-sheet/index.wxml
vendored
@ -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"
|
||||
>
|
||||
|
10
dist/slider/index.js
vendored
10
dist/slider/index.js
vendored
@ -1,7 +1,7 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { touch } from '../mixins/touch';
|
||||
import { canIUseModel } from '../common/version';
|
||||
import { getRect, addUnit, nextTick } from '../common/utils';
|
||||
import { getRect, addUnit, nextTick, addNumber, clamp } from '../common/utils';
|
||||
const DRAG_STATUS = {
|
||||
START: 'start',
|
||||
MOVING: 'moving',
|
||||
@ -196,8 +196,12 @@ VantComponent({
|
||||
return '0%';
|
||||
},
|
||||
format(value) {
|
||||
const { max, min, step } = this.data;
|
||||
return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
|
||||
const min = +this.data.min;
|
||||
const max = +this.data.max;
|
||||
const step = +this.data.step;
|
||||
value = clamp(value, min, max);
|
||||
const diff = Math.round((value - min) / step) * step;
|
||||
return addNumber(min, diff);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
7
dist/stepper/index.js
vendored
7
dist/stepper/index.js
vendored
@ -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) {
|
||||
|
2
dist/steps/index.wxss
vendored
2
dist/steps/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
|
||||
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
|
14
dist/sticky/index.js
vendored
14
dist/sticky/index.js
vendored
@ -57,10 +57,8 @@ VantComponent({
|
||||
}
|
||||
this.scrollTop = scrollTop || this.scrollTop;
|
||||
if (typeof container === 'function') {
|
||||
Promise.all([
|
||||
getRect(this, ROOT_ELEMENT),
|
||||
this.getContainerRect(),
|
||||
]).then(([root, container]) => {
|
||||
Promise.all([getRect(this, ROOT_ELEMENT), this.getContainerRect()])
|
||||
.then(([root, container]) => {
|
||||
if (offsetTop + root.height > container.height + container.top) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: false,
|
||||
@ -77,11 +75,12 @@ VantComponent({
|
||||
else {
|
||||
this.setDataAfterDiff({ fixed: false, transform: 0 });
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
return;
|
||||
}
|
||||
getRect(this, ROOT_ELEMENT).then((root) => {
|
||||
if (!isDef(root)) {
|
||||
if (!isDef(root) || (!root.width && !root.height)) {
|
||||
return;
|
||||
}
|
||||
if (offsetTop >= root.top) {
|
||||
@ -112,6 +111,9 @@ VantComponent({
|
||||
},
|
||||
getContainerRect() {
|
||||
const nodesRef = this.data.container();
|
||||
if (!nodesRef) {
|
||||
return Promise.reject(new Error('not found container'));
|
||||
}
|
||||
return new Promise((resolve) => nodesRef.boundingClientRect(resolve).exec());
|
||||
},
|
||||
},
|
||||
|
3
dist/tabs/index.js
vendored
3
dist/tabs/index.js
vendored
@ -160,6 +160,9 @@ VantComponent({
|
||||
});
|
||||
});
|
||||
if (currentIndex === data.currentIndex) {
|
||||
if (!data.inited) {
|
||||
this.resize();
|
||||
}
|
||||
return;
|
||||
}
|
||||
const shouldEmitChange = data.currentIndex !== null;
|
||||
|
4
dist/tabs/index.wxml
vendored
4
dist/tabs/index.wxml
vendored
@ -1,7 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="custom-class {{ utils.bem('tabs', [type]) }}">
|
||||
<view class="custom-class {{ utils.bem('tabs') }}">
|
||||
<van-sticky
|
||||
disabled="{{ !sticky }}"
|
||||
z-index="{{ zIndex }}"
|
||||
@ -9,7 +9,7 @@
|
||||
container="{{ container }}"
|
||||
bind:scroll="onTouchScroll"
|
||||
>
|
||||
<view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
|
||||
<view class="{{ utils.bem('tabs--') + type }} {{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
|
||||
<slot name="nav-left" />
|
||||
|
||||
<scroll-view
|
||||
|
2
dist/tabs/index.wxss
vendored
2
dist/tabs/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
||||
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff);overflow:auto}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line{height:var(--tabs-line-height,44px)}.van-tabs--card{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
7
dist/uploader/index.js
vendored
7
dist/uploader/index.js
vendored
@ -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,
|
||||
@ -34,6 +34,9 @@ VantComponent({
|
||||
}, previewFullImage: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
}, videoFit: {
|
||||
type: String,
|
||||
value: 'contain',
|
||||
}, imageFit: {
|
||||
type: String,
|
||||
value: 'scaleToFill',
|
||||
|
2
dist/uploader/index.wxml
vendored
2
dist/uploader/index.wxml
vendored
@ -28,6 +28,8 @@
|
||||
title="{{ item.name || ('视频' + index) }}"
|
||||
poster="{{ item.thumb }}"
|
||||
autoplay="{{ item.autoplay }}"
|
||||
object-fit="{{videoFit}}"
|
||||
referrer-policy="{{videoReferrerPolicy}}"
|
||||
class="van-uploader__preview-image"
|
||||
style="{{ computed.sizeStyle({ previewSize }) }}"
|
||||
data-index="{{ index }}"
|
||||
|
4
dist/uploader/shared.d.ts
vendored
4
dist/uploader/shared.d.ts
vendored
@ -29,6 +29,10 @@ export declare const videoProps: {
|
||||
type: StringConstructor;
|
||||
value: string;
|
||||
};
|
||||
referrerPolicy: {
|
||||
type: StringConstructor;
|
||||
value: string;
|
||||
};
|
||||
};
|
||||
export declare const mediaProps: {
|
||||
capture: {
|
||||
|
6
dist/uploader/shared.js
vendored
6
dist/uploader/shared.js
vendored
@ -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,
|
||||
|
34
dist/uploader/utils.js
vendored
34
dist/uploader/utils.js
vendored
@ -1,4 +1,4 @@
|
||||
import { pickExclude } from '../common/utils';
|
||||
import { pickExclude, isPC, isWxWork } from '../common/utils';
|
||||
import { isImageUrl, isVideoUrl } from '../common/validator';
|
||||
export function isImageFile(item) {
|
||||
if (item.isImage != null) {
|
||||
@ -25,7 +25,7 @@ export function isVideoFile(item) {
|
||||
return false;
|
||||
}
|
||||
function formatImage(res) {
|
||||
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { type: 'image', url: item.path, thumb: item.path })));
|
||||
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { type: 'image', url: item.tempFilePath || item.path, thumb: item.tempFilePath || item.path })));
|
||||
}
|
||||
function formatVideo(res) {
|
||||
return [
|
||||
@ -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 })));
|
||||
@ -42,13 +42,27 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration,
|
||||
return new Promise((resolve, reject) => {
|
||||
switch (accept) {
|
||||
case 'image':
|
||||
wx.chooseImage({
|
||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||
sourceType: capture,
|
||||
sizeType,
|
||||
success: (res) => resolve(formatImage(res)),
|
||||
fail: reject,
|
||||
});
|
||||
if (isPC || isWxWork) {
|
||||
wx.chooseImage({
|
||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||
sourceType: capture,
|
||||
sizeType,
|
||||
success: (res) => resolve(formatImage(res)),
|
||||
fail: reject,
|
||||
});
|
||||
}
|
||||
else {
|
||||
wx.chooseMedia({
|
||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: capture,
|
||||
maxDuration,
|
||||
sizeType,
|
||||
camera,
|
||||
success: (res) => resolve(formatImage(res)),
|
||||
fail: reject,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'media':
|
||||
wx.chooseMedia({
|
||||
|
@ -1,4 +1,229 @@
|
||||
# 更新日志
|
||||
|
||||
### [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`
|
||||
|
||||
**Feature**
|
||||
|
||||
- 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`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 修复 calendar 调用 reset 方法时丢失默认值 [#5546](https://github.com/youzan/vant-weapp/issues/5546)
|
||||
- van-notice-bar: 修复 delay 属性不生效问题 [#5547](https://github.com/youzan/vant-weapp/issues/5547)
|
||||
|
||||
**Document**
|
||||
|
||||
- skeleton: 修复 custom class 文档缺失 [#5548](https://github.com/youzan/vant-weapp/issues/5548)
|
||||
|
||||
**Feature**
|
||||
|
||||
- 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`
|
||||
|
||||
**Document**
|
||||
|
||||
- slider: 修复 use-button-slot 文档错误 [#5534](https://github.com/youzan/vant-weapp/issues/5534)
|
||||
|
||||
**Feature**
|
||||
|
||||
- button: 增加 button-id 属性 和 agreePrivacyAuthorization 事件支持 [#5533](https://github.com/youzan/vant-weapp/issues/5533)
|
||||
|
||||
### [v1.10.24](https://github.com/youzan/vant-weapp/compare/v1.10.23...v1.10.24)
|
||||
|
||||
`2023-08-25`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 增加 limit date 监听 [#5520](https://github.com/youzan/vant-weapp/issues/5520)
|
||||
|
||||
**Feature**
|
||||
|
||||
- button: 增加 agreePrivacyAuthorization open-type 支持 [#5527](https://github.com/youzan/vant-weapp/issues/5527)
|
||||
|
||||
### [v1.10.23](https://github.com/youzan/vant-weapp/compare/v1.10.22...v1.10.23)
|
||||
|
||||
`2023-07-28`
|
||||
|
||||
**Feature**
|
||||
|
||||
- dialog: 增加 confirm/cancel button slot 支持 [#5502](https://github.com/youzan/vant-weapp/issues/5502)
|
||||
- Search: 增加 cursor-spacing 属性支持 [#5498](https://github.com/youzan/vant-weapp/issues/5498)
|
||||
|
||||
### [v1.10.22](https://github.com/youzan/vant-weapp/compare/v1.10.21...v1.10.22)
|
||||
|
||||
`2023-07-24`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- field: 修复 error message 居中错误 [#5482](https://github.com/youzan/vant-weapp/issues/5482)
|
||||
- GoodsAction: 修复自定义 icon 时样式错误 [#5496](https://github.com/youzan/vant-weapp/issues/5496)
|
||||
- sticky: 修复渲染位置错误再 transition 中 [#5483](https://github.com/youzan/vant-weapp/issues/5483)
|
||||
|
||||
### [v1.10.21](https://github.com/youzan/vant-weapp/compare/v1.10.20...v1.10.21)
|
||||
|
||||
`2023-07-10`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- uploader: 修复无法唤起选择图片框在 PC 下 [#5477](https://github.com/youzan/vant-weapp/issues/5477)
|
||||
|
||||
**Feature**
|
||||
|
||||
- button: 增加 getRealtimePhoneNumber 支持 [#5471](https://github.com/youzan/vant-weapp/issues/5471)
|
||||
- calendar: 增加 default-date 为 null 支持 [#5395](https://github.com/youzan/vant-weapp/issues/5395)
|
||||
- dialog: 增加确认/取消按钮外部样式类支持 [#5478](https://github.com/youzan/vant-weapp/issues/5478)
|
||||
- field: 增加自定义样式类支持 [#5476](https://github.com/youzan/vant-weapp/issues/5476)
|
||||
- field: 扩大 input 点击区域支持 [#5479](https://github.com/youzan/vant-weapp/issues/5479)
|
||||
- Upload: 增加 videoFit 属性支持 [#5475](https://github.com/youzan/vant-weapp/issues/5475)
|
||||
|
||||
### [v1.10.20](https://github.com/youzan/vant-weapp/compare/v1.10.19...v1.10.20)
|
||||
|
||||
`2023-07-03`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 修复无法选择同一天在 range 模式下 [#5451](https://github.com/youzan/vant-weapp/issues/5451)
|
||||
- slider: 修复小数精度丢失问题 [#5444](https://github.com/youzan/vant-weapp/issues/5444)
|
||||
|
||||
**Document**
|
||||
|
||||
- add @inottn and @zhousg to core team [#5453](https://github.com/youzan/vant-weapp/issues/5453)
|
||||
- popup: 修复文档缺失 close-icon-position 属性 [#5389](https://github.com/youzan/vant-weapp/pull/5389)
|
||||
- dialog: 修复示例代码错误问题 [#5389](https://github.com/youzan/vant-weapp/pull/5389)
|
||||
|
||||
**Feature**
|
||||
|
||||
- goods-action-icon: 增加 size 属性 [#5457](https://github.com/youzan/vant-weapp/issues/5457)
|
||||
- goods-action-icon: 增加 info-class 自定义样式类 [#5457](https://github.com/youzan/vant-weapp/issues/5457)
|
||||
- icon: 增加 info-class 自定义样式类 [#5458](https://github.com/youzan/vant-weapp/issues/5458)
|
||||
|
||||
### [v1.10.19](https://github.com/youzan/vant-weapp/compare/v1.10.18...v1.10.19)
|
||||
|
||||
`2023-05-19`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 修复日历月份标题不同步问题 [#5381](https://github.com/youzan/vant-weapp/pull/5381)
|
||||
- cascader: 修复选中项目缺失和 fieldNames 不生效问题 [#5182](https://github.com/youzan/vant-weapp/pull/5185)
|
||||
- cascader: 修复异步数据视图不更新问题 [#5380](https://github.com/youzan/vant-weapp/pull/5380)
|
||||
- tab: 修复异步数据情况选中线向右偏移问题 [#5135](https://github.com/youzan/vant-weapp/issues/5135)
|
||||
|
||||
### [v1.10.18](https://github.com/youzan/vant-weapp/compare/v1.10.17...v1.10.18)
|
||||
|
||||
`2023-05-08`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- steps: 修复在竖向模式下 icon 被覆盖的问题 [#5329](https://github.com/youzan/vant-weapp/issues/5329)
|
||||
- tabs: 修复 tab 较多时,slot 无法正常显示问题 [#4700](https://github.com/youzan/vant-weapp/issues/4700)
|
||||
|
||||
**Feature**
|
||||
|
||||
- field: input/change 事件增加 callback 参数 [#5345](https://github.com/youzan/vant-weapp/issues/5345)
|
||||
- goods-action: goods-action-button 增加 size 属性 [#5347](https://github.com/youzan/vant-weapp/issues/5347)
|
||||
|
||||
### [v1.10.17](https://github.com/youzan/vant-weapp/compare/v1.10.16...v1.10.17)
|
||||
|
||||
`2023-05-04`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- icon: 修复定位样式错误在外部传入 custom-class 的情况下 [#5335](https://github.com/youzan/vant-weapp/issues/5335)
|
||||
- tab: 修复 tab 被嵌套时,内部 tab 样式错误问题 [#5200](https://github.com/youzan/vant-weapp/issues/5200)
|
||||
- Uploader: 替换 wx.chooseImage 为 wx.chooseMedia 解决选择图片页面刷新问题 [#5343](https://github.com/youzan/vant-weapp/issues/5343)
|
||||
- van-field: 修复安卓设备下 textarea maxlength 限制不生效问题 [#5308](https://github.com/youzan/vant-weapp/issues/5308)
|
||||
|
||||
### [v1.10.16](https://github.com/youzan/vant-weapp/compare/v1.10.15...v1.10.16)
|
||||
|
||||
`2023-04-18`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- icon: 修复显示异常在自定义图标的模式下 [#5320](https://github.com/youzan/vant-weapp/issues/5320)
|
||||
- stepper: 修复最大值在设置字符串下功能错误问题 [#5295](https://github.com/youzan/vant-weapp/issues/5295)
|
||||
- tabs: 修复在部分设备下 info 样式错误问题 [#5318](https://github.com/youzan/vant-weapp/issues/5318)
|
||||
|
||||
### [v1.10.15](https://github.com/youzan/vant-weapp/compare/v1.10.14...v1.10.15)
|
||||
|
||||
`2023-04-03`
|
||||
@ -34,15 +259,14 @@
|
||||
- overlay: 增加 root-portal 属性支持 [#5255](https://github.com/youzan/vant-weapp/issues/5255)
|
||||
- popup: 增加 root-portal 属性支持 [#5254](https://github.com/youzan/vant-weapp/issues/5254)
|
||||
|
||||
|
||||
### [v1.10.13](https://github.com/youzan/vant-weapp/compare/v1.10.12...v1.10.13)
|
||||
|
||||
`2023-02-13`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 修复calendar组件安全区域传参未传递给popup组件的问题 [db7957](https://github.com/youzan/vant-weapp/commit/db79570d98537db669730aa66d3fb3932ded4737)
|
||||
- cascader: 修复cascader组件onClickTab事件没有同步activeTab的值导致选择异常的问题 [92ae4a](https://github.com/youzan/vant-weapp/commit/92ae4a29c0b99aa65be6a71004b795ae2650f37c)
|
||||
- calendar: 修复 calendar 组件安全区域传参未传递给 popup 组件的问题 [db7957](https://github.com/youzan/vant-weapp/commit/db79570d98537db669730aa66d3fb3932ded4737)
|
||||
- cascader: 修复 cascader 组件 onClickTab 事件没有同步 activeTab 的值导致选择异常的问题 [92ae4a](https://github.com/youzan/vant-weapp/commit/92ae4a29c0b99aa65be6a71004b795ae2650f37c)
|
||||
- stepper: 修复 always-embed 申明两次警告问题 [#5231](https://github.com/youzan/vant-weapp/issues/5231)
|
||||
- stepper: 修复 onblur 时在值变更的情况下 change 事件没有触发 [#5227](https://github.com/youzan/vant-weapp/issues/5227)
|
||||
|
||||
@ -53,7 +277,6 @@
|
||||
- tabbar-item: 增加 url link-type 属性支持 [#5232](https://github.com/youzan/vant-weapp/issues/5232)
|
||||
- uploader: 增加 showmenu 属性支持 [#5229](https://github.com/youzan/vant-weapp/issues/5229)
|
||||
|
||||
|
||||
### [v1.10.12](https://github.com/youzan/vant-weapp/compare/v1.10.11...v1.10.12)
|
||||
|
||||
`2023-01-16`
|
||||
@ -61,17 +284,17 @@
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 修复在 allow-same-day 情况下初始不能选择同一天 [#5193](https://github.com/youzan/vant-weapp/issues/5193)
|
||||
- stepper: 修复在 async change 情况下外部无法更新 input 值 [#5191](https://github.com/youzan/vant-weapp/issues/5191)
|
||||
- stepper: 修复在 async change 情况下外部无法更新 input 值 [#5191](https://github.com/youzan/vant-weapp/issues/5191)
|
||||
|
||||
**Document**
|
||||
- docs(action-sheet): 修复close-on-click-overlay初始值书写错误 [b2fabe](https://github.com/youzan/vant-weapp/commit/b2fabe6b2b72ce1734b9123b00e78a854111d240)
|
||||
|
||||
- docs(action-sheet): 修复 close-on-click-overlay 初始值书写错误 [b2fabe](https://github.com/youzan/vant-weapp/commit/b2fabe6b2b72ce1734b9123b00e78a854111d240)
|
||||
|
||||
**Feature**
|
||||
|
||||
- dropdown-menu: 增加 use-before-toggle 属性支持 [#5190](https://github.com/youzan/vant-weapp/issues/5190)
|
||||
- field: 增加 extra-event-params 属性支持 [#5184](https://github.com/youzan/vant-weapp/issues/5184)
|
||||
|
||||
|
||||
### [v1.10.11](https://github.com/youzan/vant-weapp/compare/v1.10.10...v1.10.11)
|
||||
|
||||
`2023-01-03`
|
||||
@ -113,11 +336,13 @@
|
||||
`2022-12-12`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- slider: 修复文档示例值错误 [#5128](https://github.com/youzan/vant-weapp/issues/5128)
|
||||
- tab: 修复在开启微信工具热更新时出现堆栈溢出问题 [#5125](https://github.com/youzan/vant-weapp/issues/5125)
|
||||
- transition: 修复页面切后台后无法触发 transition 相关组件更新 [#5131](https://github.com/youzan/vant-weapp/issues/5131)
|
||||
|
||||
**Feature**
|
||||
|
||||
- cascader: 新增 cascader 组件 [#4992](https://github.com/youzan/vant-weapp/issues/4992)
|
||||
|
||||
### [v1.10.8](https://github.com/youzan/vant-weapp/compare/v1.10.7...v1.10.8)
|
||||
@ -132,13 +357,12 @@
|
||||
**Document**
|
||||
|
||||
- Calendar: 修复示例代码错误问题 [c55c78](https://github.com/youzan/vant-weapp/commit/c55c785a9ed67e0801c693d61b1e7e691bd19cf1)
|
||||
- fix(stepper): 修复stepper blur事件失焦时会触发change事件 [8b441d](https://github.com/youzan/vant-weapp/commit/8b441de1a6a0d439913d6a582d954331ff17e1fa)
|
||||
- fix(stepper): 修复 stepper blur 事件失焦时会触发 change 事件 [8b441d](https://github.com/youzan/vant-weapp/commit/8b441de1a6a0d439913d6a582d954331ff17e1fa)
|
||||
|
||||
**Feature**
|
||||
|
||||
- dialog: 增加 custom-class 属性支持 [#5102](https://github.com/youzan/vant-weapp/issues/5102)
|
||||
- uploader: 增加 media-type 属性支持 [#5113](https://github.com/youzan/vant-weapp/issues/5113)
|
||||
|
||||
- uploader: 增加 media-type 属性支持 [#5113](https://github.com/youzan/vant-weapp/issues/5113)
|
||||
|
||||
### [v1.10.7](https://github.com/youzan/vant-weapp/compare/v1.10.6...v1.10.7)
|
||||
|
||||
@ -149,6 +373,7 @@
|
||||
- search: 增加 value 默认 props 定义 [697746](https://github.com/youzan/vant-weapp/commit/697746fb470e9e16476f3fe95c15e4448ca9d686)
|
||||
|
||||
**Document**
|
||||
|
||||
- collapse: 增加 right-icon 额外使用说明 [d39b35](https://github.com/youzan/vant-weapp/commit/d39b35fc3a1d4b913d7b94bb45b3e861e3cee79e)
|
||||
|
||||
**Feature**
|
||||
@ -156,8 +381,6 @@
|
||||
- action-sheet: 增加自定义样式能力支持 [#5097](https://github.com/youzan/vant-weapp/issues/5097)
|
||||
- dropdown-menu: 增加多个自定义样式能力支持 [#5099](https://github.com/youzan/vant-weapp/issues/5099)
|
||||
|
||||
|
||||
|
||||
### [v1.10.6](https://github.com/youzan/vant-weapp/compare/v1.10.5...v1.10.6)
|
||||
|
||||
`2022-11-06`
|
||||
@ -168,11 +391,11 @@
|
||||
- button: 修复 button 在 disabeld 或 loading 时能触发 active 状态问题 [#5084](https://github.com/youzan/vant-weapp/issues/5084)
|
||||
- mixin: 修复 page-scroll mixin 函数监听没有收回问题 [#5086](https://github.com/youzan/vant-weapp/issues/5086)
|
||||
- overlay: 修复 custom-class 不生效问题 [#5083](https://github.com/youzan/vant-weapp/issues/5083)
|
||||
- slider: 修复 slider 在 value 小于 step 无法滑动问题 [#5079](https://github.com/youzan/vant-weapp/issues/5079)
|
||||
- slider: 修复 slider 在 value 小于 step 无法滑动问题 [#5079](https://github.com/youzan/vant-weapp/issues/5079)
|
||||
|
||||
**Feature**
|
||||
- Dialog: option context 支持传入函数 [#5043](https://github.com/youzan/vant-weapp/issues/5043)
|
||||
|
||||
- Dialog: option context 支持传入函数 [#5043](https://github.com/youzan/vant-weapp/issues/5043)
|
||||
|
||||
### [v1.10.5](https://github.com/youzan/vant-weapp/compare/v1.10.4...v1.10.5)
|
||||
|
||||
@ -1130,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)
|
||||
|
||||

|
||||
|
||||
|
@ -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)
|
||||
|
||||
## 贡献
|
||||
@ -37,13 +37,13 @@ Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
|
||||
|
||||
以下是 Vant 和 Vant Weapp 的核心贡献者们:
|
||||
|
||||
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) |
|
||||
| :-: | :-: | :-: | :-: | :-: |
|
||||
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) |
|
||||
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) | [](https://github.com/nemo-shen/) |
|
||||
| :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) | [nemo-shen](https://github.com/nemo-shen/) |
|
||||
|
||||
| [](https://github.com/nemo-shen/) | [](https://github.com/Lindysen/) | [](https://github.com/JakeLaoyu/) | [](https://github.com/landluck/) | [](https://github.com/wjw-gavin/) |
|
||||
| :-: | :-: | :-: | :-: | :-: |
|
||||
| [nemo-shen](https://github.com/nemo-shen/) | [Lindysen](https://github.com/Lindysen/) | [JakeLaoyu](https://github.com/JakeLaoyu/) | [landluck](https://github.com/landluck/) | [wjw-gavin](https://github.com/wjw-gavin/) |
|
||||
| [](https://github.com/Lindysen/) | [](https://github.com/JakeLaoyu/) | [](https://github.com/landluck/) | [](https://github.com/wjw-gavin/) | [](https://github.com/inottn/) | [](https://github.com/zhousg/) |
|
||||
| :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [Lindysen](https://github.com/Lindysen/) | [JakeLaoyu](https://github.com/JakeLaoyu/) | [landluck](https://github.com/landluck/) | [wjw-gavin](https://github.com/wjw-gavin/) | [inottn](https://github.com/inottn/) | [zhousg](https://github.com/zhousg/) |
|
||||
|
||||
### 贡献者们
|
||||
|
||||
|
@ -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 开发小程序,还需要做如下操作,以获得顺畅的开发体验。
|
||||
|
||||
|
@ -45,6 +45,10 @@ export default [
|
||||
path: '/calendar',
|
||||
title: 'Calendar 日历',
|
||||
},
|
||||
{
|
||||
path: '/cascader',
|
||||
title: 'Cascader 级联选择',
|
||||
},
|
||||
{
|
||||
path: '/checkbox',
|
||||
title: 'Checkbox 复选框',
|
||||
|
@ -38,10 +38,11 @@
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"showES6CompileOption": false,
|
||||
"ignoreUploadUnusedFiles": true
|
||||
"ignoreUploadUnusedFiles": true,
|
||||
"condition": false
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.6.5",
|
||||
"libVersion": "2.27.3",
|
||||
"appid": "wx1c01b35002d3ba14",
|
||||
"projectname": "vant-weapp",
|
||||
"condition": {
|
||||
@ -333,6 +334,12 @@
|
||||
"pathName": "pages/divider/index",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "cascader",
|
||||
"pathName": "pages/cascader/index",
|
||||
"query": "",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ var button_1 = require("../mixins/button");
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onSelect: function (event) {
|
||||
|
@ -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">
|
||||
|
@ -2,7 +2,7 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<button
|
||||
id="{{ id }}"
|
||||
id="{{ id || buttonId }}"
|
||||
data-detail="{{ dataset }}"
|
||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
|
||||
hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
|
||||
@ -22,6 +22,8 @@
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
|
@ -1,3 +1,5 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<view class="van-calendar">
|
||||
<header
|
||||
title="{{ title }}"
|
||||
|
@ -56,6 +56,7 @@ var getTime = function (date) {
|
||||
},
|
||||
defaultDate: {
|
||||
type: null,
|
||||
value: (0, utils_1.getToday)().getTime(),
|
||||
observer: function (val) {
|
||||
this.setData({ currentDate: val });
|
||||
this.scrollIntoView();
|
||||
@ -128,12 +129,24 @@ var getTime = function (date) {
|
||||
value: 0,
|
||||
},
|
||||
readonly: Boolean,
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
subtitle: '',
|
||||
currentDate: null,
|
||||
scrollIntoView: '',
|
||||
},
|
||||
watch: {
|
||||
minDate: function () {
|
||||
this.initRect();
|
||||
},
|
||||
maxDate: function () {
|
||||
this.initRect();
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
this.setData({
|
||||
currentDate: this.getInitialDate(this.data.defaultDate),
|
||||
@ -147,7 +160,7 @@ var getTime = function (date) {
|
||||
},
|
||||
methods: {
|
||||
reset: function () {
|
||||
this.setData({ currentDate: this.getInitialDate() });
|
||||
this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
|
||||
this.scrollIntoView();
|
||||
},
|
||||
initRect: function () {
|
||||
@ -185,13 +198,16 @@ var getTime = function (date) {
|
||||
var _this = this;
|
||||
if (defaultDate === void 0) { defaultDate = null; }
|
||||
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay;
|
||||
if (!defaultDate)
|
||||
return [];
|
||||
var now = (0, utils_1.getToday)().getTime();
|
||||
if (type === 'range') {
|
||||
if (!Array.isArray(defaultDate)) {
|
||||
defaultDate = [];
|
||||
}
|
||||
var _b = defaultDate || [], startDay = _b[0], endDay = _b[1];
|
||||
var start = this.limitDateRange(startDay || now, minDate, (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
|
||||
var startDate = getTime(startDay || now);
|
||||
var start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
|
||||
var date = getTime(endDay || now);
|
||||
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
@ -211,6 +227,8 @@ var getTime = function (date) {
|
||||
var _this = this;
|
||||
(0, utils_2.requestAnimationFrame)(function () {
|
||||
var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate;
|
||||
if (!currentDate)
|
||||
return;
|
||||
// @ts-ignore
|
||||
var targetDate = type === 'single' ? currentDate : currentDate[0];
|
||||
var displayed = show || !poppable;
|
||||
|
@ -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"
|
||||
|
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
||||
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
|
@ -26,7 +26,6 @@ var defaultFieldNames = {
|
||||
title: String,
|
||||
value: {
|
||||
type: String,
|
||||
observer: 'updateValue',
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
@ -39,7 +38,6 @@ var defaultFieldNames = {
|
||||
options: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: 'updateOptions',
|
||||
},
|
||||
swipeable: {
|
||||
type: Boolean,
|
||||
@ -62,6 +60,7 @@ var defaultFieldNames = {
|
||||
value: defaultFieldNames,
|
||||
observer: 'updateFieldNames',
|
||||
},
|
||||
useTitleSlot: Boolean,
|
||||
},
|
||||
data: {
|
||||
tabs: [],
|
||||
@ -69,15 +68,20 @@ var defaultFieldNames = {
|
||||
textKey: FieldName.TEXT,
|
||||
valueKey: FieldName.VALUE,
|
||||
childrenKey: FieldName.CHILDREN,
|
||||
innerValue: '',
|
||||
},
|
||||
watch: {
|
||||
options: function () {
|
||||
this.updateTabs();
|
||||
},
|
||||
value: function (newVal) {
|
||||
this.updateValue(newVal);
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
this.updateTabs();
|
||||
},
|
||||
methods: {
|
||||
updateOptions: function (val, oldVal) {
|
||||
var isAsync = !!(val.length && oldVal.length);
|
||||
this.updateTabs(isAsync);
|
||||
},
|
||||
updateValue: function (val) {
|
||||
var _this = this;
|
||||
if (val !== undefined) {
|
||||
@ -86,6 +90,7 @@ var defaultFieldNames = {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.innerValue = val;
|
||||
this.updateTabs();
|
||||
},
|
||||
updateFieldNames: function () {
|
||||
@ -110,12 +115,15 @@ var defaultFieldNames = {
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTabs: function (isAsync) {
|
||||
updateTabs: function () {
|
||||
var _this = this;
|
||||
if (isAsync === void 0) { isAsync = false; }
|
||||
var _a = this.data, options = _a.options, value = _a.value;
|
||||
if (value !== undefined) {
|
||||
var selectedOptions = this.getSelectedOptionsByValue(options, value);
|
||||
var options = this.data.options;
|
||||
var innerValue = this.innerValue;
|
||||
if (!options.length) {
|
||||
return;
|
||||
}
|
||||
if (innerValue !== undefined) {
|
||||
var selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
|
||||
if (selectedOptions) {
|
||||
var optionsCursor_1 = options;
|
||||
var tabs_1 = selectedOptions.map(function (option) {
|
||||
@ -146,16 +154,6 @@ var defaultFieldNames = {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 异步更新
|
||||
if (isAsync) {
|
||||
var tabs = this.data.tabs;
|
||||
tabs[tabs.length - 1].options =
|
||||
options[options.length - 1][this.data.childrenKey];
|
||||
this.setData({
|
||||
tabs: tabs,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
tabs: [
|
||||
{
|
||||
@ -163,6 +161,7 @@ var defaultFieldNames = {
|
||||
selected: null,
|
||||
},
|
||||
],
|
||||
activeTab: 0,
|
||||
});
|
||||
},
|
||||
onClose: function () {
|
||||
@ -209,11 +208,13 @@ var defaultFieldNames = {
|
||||
tabs: tabs,
|
||||
});
|
||||
var selectedOptions = tabs.map(function (tab) { return tab.selected; }).filter(Boolean);
|
||||
var value = option[valueKey];
|
||||
var params = {
|
||||
value: option[valueKey],
|
||||
value: value,
|
||||
tabIndex: tabIndex,
|
||||
selectedOptions: selectedOptions,
|
||||
};
|
||||
this.innerValue = value;
|
||||
this.$emit('change', params);
|
||||
if (!option[childrenKey]) {
|
||||
this.$emit('finish', params);
|
||||
|
@ -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 }}"
|
||||
@ -37,14 +38,14 @@
|
||||
wx:for="{{ tab.options }}"
|
||||
wx:for-item="option"
|
||||
wx:key="index"
|
||||
class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}"
|
||||
style="{{ utils.optionStyle({ tab, textKey, option, activeColor }) }}"
|
||||
class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
|
||||
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
|
||||
data-option="{{ option }}"
|
||||
data-tab-index="{{ tabIndex }}"
|
||||
bind:tap="onSelect"
|
||||
>
|
||||
<text>{{ option[textKey] }}</text>
|
||||
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
|
||||
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 暂不支持 -->
|
||||
|
@ -1,16 +1,16 @@
|
||||
var utils = require('../wxs/utils.wxs');
|
||||
var style = require('../wxs/style.wxs');
|
||||
|
||||
function isSelected(tab, textKey, option) {
|
||||
return tab.selected && tab.selected[textKey] === option[textKey]
|
||||
function isSelected(tab, valueKey, option) {
|
||||
return tab.selected && tab.selected[valueKey] === option[valueKey]
|
||||
}
|
||||
|
||||
function optionClass(tab, textKey, option) {
|
||||
return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled })
|
||||
function optionClass(tab, valueKey, option) {
|
||||
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
|
||||
}
|
||||
|
||||
function optionStyle(data) {
|
||||
var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
|
||||
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
|
||||
return style({
|
||||
color
|
||||
});
|
||||
|
@ -98,6 +98,8 @@ var STEP = 1;
|
||||
var _a = this.data, color = _a.color, size = _a.size;
|
||||
if ((0, validator_1.isObj)(color)) {
|
||||
return this.getContext().then(function (context) {
|
||||
if (!context)
|
||||
return;
|
||||
var LinearColor = context.createLinearGradient(size, 0, 0, 0);
|
||||
Object.keys(color)
|
||||
.sort(function (a, b) { return parseFloat(a) - parseFloat(b); })
|
||||
@ -142,6 +144,8 @@ var STEP = 1;
|
||||
var _this = this;
|
||||
var size = this.data.size;
|
||||
this.getContext().then(function (context) {
|
||||
if (!context)
|
||||
return;
|
||||
context.clearRect(0, 0, size, size);
|
||||
_this.renderLayerCircle(context);
|
||||
var formatValue = format(currentValue);
|
||||
|
4
lib/common/utils.d.ts
vendored
4
lib/common/utils.d.ts
vendored
@ -14,4 +14,8 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
|
||||
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
|
||||
export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
|
||||
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>;
|
||||
export declare function addNumber(num1: any, num2: any): number;
|
||||
export declare const clamp: (num: any, min: any, max: any) => number;
|
||||
export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;
|
||||
export declare const isPC: boolean;
|
||||
export declare const isWxWork: boolean;
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getCurrentPage = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0;
|
||||
exports.isWxWork = exports.isPC = exports.getCurrentPage = exports.clamp = exports.addNumber = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0;
|
||||
var validator_1 = require("./validator");
|
||||
var version_1 = require("./version");
|
||||
var validator_2 = require("./validator");
|
||||
@ -90,8 +90,20 @@ function toPromise(promiseLike) {
|
||||
return Promise.resolve(promiseLike);
|
||||
}
|
||||
exports.toPromise = toPromise;
|
||||
// 浮点数精度处理
|
||||
function addNumber(num1, num2) {
|
||||
var cardinal = Math.pow(10, 10);
|
||||
return Math.round((num1 + num2) * cardinal) / cardinal;
|
||||
}
|
||||
exports.addNumber = addNumber;
|
||||
// 限制value在[min, max]之间
|
||||
var clamp = function (num, min, max) { return Math.min(Math.max(num, min), max); };
|
||||
exports.clamp = clamp;
|
||||
function getCurrentPage() {
|
||||
var pages = getCurrentPages();
|
||||
return pages[pages.length - 1];
|
||||
}
|
||||
exports.getCurrentPage = getCurrentPage;
|
||||
exports.isPC = ['mac', 'windows'].includes((0, version_1.getSystemInfoSync)().platform);
|
||||
// 是否企业微信
|
||||
exports.isWxWork = (0, version_1.getSystemInfoSync)().environment === 'wxwork';
|
||||
|
8
lib/common/version.d.ts
vendored
8
lib/common/version.d.ts
vendored
@ -1,5 +1,10 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
export declare function getSystemInfoSync(): WechatMiniprogram.SystemInfo;
|
||||
interface WxWorkSystemInfo extends WechatMiniprogram.SystemInfo {
|
||||
environment?: 'wxwork';
|
||||
}
|
||||
interface SystemInfo extends WxWorkSystemInfo, WechatMiniprogram.SystemInfo {
|
||||
}
|
||||
export declare function getSystemInfoSync(): SystemInfo;
|
||||
export declare function canIUseModel(): boolean;
|
||||
export declare function canIUseFormFieldButton(): boolean;
|
||||
export declare function canIUseAnimate(): boolean;
|
||||
@ -7,3 +12,4 @@ export declare function canIUseGroupSetData(): boolean;
|
||||
export declare function canIUseNextTick(): boolean;
|
||||
export declare function canIUseCanvas2d(): boolean;
|
||||
export declare function canIUseGetUserProfile(): boolean;
|
||||
export {};
|
||||
|
1
lib/definitions/index.d.ts
vendored
1
lib/definitions/index.d.ts
vendored
@ -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;
|
||||
|
@ -6,6 +6,7 @@ var color_1 = require("../common/color");
|
||||
var utils_1 = require("../common/utils");
|
||||
(0, component_1.VantComponent)({
|
||||
mixins: [button_1.button],
|
||||
classes: ['cancle-button-class', 'confirm-button-class'],
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
@ -19,14 +20,17 @@ var utils_1 = require("../common/utils");
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
useSlot: Boolean,
|
||||
confirmButtonId: String,
|
||||
className: String,
|
||||
customStyle: String,
|
||||
asyncClose: Boolean,
|
||||
messageAlign: String,
|
||||
beforeClose: null,
|
||||
overlayStyle: String,
|
||||
useSlot: Boolean,
|
||||
useTitleSlot: Boolean,
|
||||
useConfirmButtonSlot: Boolean,
|
||||
useCancelButtonSlot: Boolean,
|
||||
showCancelButton: Boolean,
|
||||
closeOnClickOverlay: Boolean,
|
||||
confirmButtonOpenType: String,
|
||||
@ -63,6 +67,10 @@ var utils_1 = require("../common/utils");
|
||||
type: String,
|
||||
value: 'scale',
|
||||
},
|
||||
rootPortal: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
loading: {
|
||||
|
@ -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
|
||||
@ -33,7 +34,7 @@
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel"
|
||||
custom-class="van-dialog__cancel cancle-button-class"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
@ -44,9 +45,9 @@
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
custom-class="van-dialog__confirm confirm-button-class"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
|
||||
button-id="{{ confirmButtonId }}"
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
@ -56,7 +57,8 @@
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
|
||||
bind:click="onConfirm"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
@ -70,44 +72,54 @@
|
||||
</van-goods-action>
|
||||
|
||||
<view wx:elif="{{ showCancelButton || showConfirmButton }}" class="van-hairline--top van-dialog__footer">
|
||||
<van-button
|
||||
wx:if="{{ showCancelButton }}"
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
{{ cancelButtonText }}
|
||||
</van-button>
|
||||
<van-button
|
||||
wx:if="{{ showConfirmButton }}"
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
<block wx:if="{{ showCancelButton }}">
|
||||
<slot wx:if="{{ useCancelButtonSlot }}" name="cancel-button" />
|
||||
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
<van-button
|
||||
wx:else
|
||||
size="large"
|
||||
loading="{{ loading.cancel }}"
|
||||
class="van-dialog__button van-hairline--right"
|
||||
custom-class="van-dialog__cancel cancle-button-class"
|
||||
custom-style="color: {{ cancelButtonColor }}"
|
||||
bind:click="onCancel"
|
||||
>
|
||||
{{ cancelButtonText }}
|
||||
</van-button>
|
||||
</block>
|
||||
|
||||
bind:click="onConfirm"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
>
|
||||
{{ confirmButtonText }}
|
||||
</van-button>
|
||||
<block wx:if="{{ showConfirmButton }}">
|
||||
<slot wx:if="{{ useConfirmButtonSlot }}" name="confirm-button" />
|
||||
|
||||
<van-button
|
||||
wx:else
|
||||
size="large"
|
||||
class="van-dialog__button"
|
||||
loading="{{ loading.confirm }}"
|
||||
custom-class="van-dialog__confirm confirm-button-class"
|
||||
custom-style="color: {{ confirmButtonColor }}"
|
||||
button-id="{{ confirmButtonId }}"
|
||||
open-type="{{ confirmButtonOpenType }}"
|
||||
lang="{{ lang }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
|
||||
bind:click="onConfirm"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindcontact="onContact"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
binderror="onError"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
bindopensetting="onOpenSetting"
|
||||
>
|
||||
{{ confirmButtonText }}
|
||||
</van-button>
|
||||
</block>
|
||||
</view>
|
||||
</van-popup>
|
||||
|
@ -44,16 +44,36 @@ 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 });
|
||||
},
|
||||
methods: {
|
||||
formatValue: function (value) {
|
||||
var maxlength = this.data.maxlength;
|
||||
if (maxlength !== -1 && value.length > maxlength) {
|
||||
return value.slice(0, maxlength);
|
||||
}
|
||||
return value;
|
||||
},
|
||||
onInput: function (event) {
|
||||
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
|
||||
this.value = value;
|
||||
var formatValue = this.formatValue(value);
|
||||
this.value = formatValue;
|
||||
this.setShowClear();
|
||||
this.emitChange(event.detail);
|
||||
return this.emitChange(__assign(__assign({}, event.detail), { value: formatValue }));
|
||||
},
|
||||
onFocus: function (event) {
|
||||
this.focused = true;
|
||||
@ -101,15 +121,20 @@ 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 _this = this;
|
||||
var extraEventParams = this.data.extraEventParams;
|
||||
this.setData({ value: detail.value });
|
||||
(0, utils_1.nextTick)(function () {
|
||||
var data = extraEventParams ? detail : detail.value;
|
||||
_this.$emit('input', data);
|
||||
_this.$emit('change', data);
|
||||
});
|
||||
var result;
|
||||
var data = extraEventParams
|
||||
? __assign(__assign({}, detail), { callback: function (data) {
|
||||
result = data;
|
||||
} }) : detail.value;
|
||||
this.$emit('input', data);
|
||||
this.$emit('change', data);
|
||||
return result;
|
||||
},
|
||||
setShowClear: function () {
|
||||
var _a = this.data, clearable = _a.clearable, readonly = _a.readonly, clearTrigger = _a.clearTrigger;
|
||||
@ -120,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 () { },
|
||||
},
|
||||
|
@ -13,12 +13,12 @@
|
||||
title-style="margin-right: 12px;"
|
||||
custom-style="{{ customStyle }}"
|
||||
arrow-direction="{{ arrowDirection }}"
|
||||
custom-class="van-field"
|
||||
custom-class="custom-class van-field"
|
||||
>
|
||||
<slot name="left-icon" slot="icon" />
|
||||
<view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
<label for="{{ name }}" wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
{{ label }}
|
||||
</view>
|
||||
</label>
|
||||
<slot wx:else name="label" slot="title" />
|
||||
<view class="{{ utils.bem('field__body', [type]) }}">
|
||||
<view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
|
||||
@ -47,10 +47,10 @@
|
||||
<slot name="button" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<label for="{{ name }}" wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
|
||||
</view>
|
||||
<view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
</label>
|
||||
<label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
{{ errorMessage }}
|
||||
</view>
|
||||
</label>
|
||||
</van-cell>
|
||||
|
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-field{--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:var(--field-label-color,#646566)}.van-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{align-items:center;display:flex}.van-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.van-field__control:empty+.van-field__control{display:block}.van-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,#323233);display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.van-field__control:empty{display:none}.van-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.van-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{color:var(--field-clear-icon-color,#c8c9cc);font-size:var(--field-clear-icon-size,16px)}.van-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{color:var(--field-error-message-color,#ee0a24);font-size:var(--field-error-message-text-font-size,12px);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.van-field__word-num{display:inline}.van-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
|
||||
@import '../common/index.wxss';.van-field{--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:var(--field-label-color,#646566)}.van-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{align-items:center;display:flex}.van-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.van-field__control:empty+.van-field__control{display:block}.van-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,#323233);display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.van-field__control:empty{display:none}.van-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.van-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{color:var(--field-clear-icon-color,#c8c9cc);font-size:var(--field-clear-icon-size,16px)}.van-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.van-field__word-num{display:inline}.van-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
|
@ -1,4 +1,6 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<input
|
||||
id="{{ name }}"
|
||||
class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
|
||||
type="{{ type }}"
|
||||
focus="{{ focus }}"
|
||||
@ -25,4 +27,5 @@
|
||||
bindfocus="onFocus"
|
||||
bindconfirm="onConfirm"
|
||||
bindkeyboardheightchange="onKeyboardHeightChange"
|
||||
bindnicknamereview="onBindNicknameReview"
|
||||
/>
|
||||
|
@ -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,
|
||||
|
@ -1,4 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<textarea
|
||||
id="{{ name }}"
|
||||
class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
|
||||
fixed="{{ fixed }}"
|
||||
focus="{{ focus }}"
|
||||
|
@ -10,6 +10,10 @@ var link_1 = require("../mixins/link");
|
||||
props: {
|
||||
text: String,
|
||||
color: String,
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal',
|
||||
},
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
plain: Boolean,
|
||||
@ -17,6 +21,10 @@ var link_1 = require("../mixins/link");
|
||||
type: String,
|
||||
value: 'danger',
|
||||
},
|
||||
customStyle: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClick: function (event) {
|
||||
|
@ -1,15 +1,18 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<van-button
|
||||
id="{{ id }}"
|
||||
button-id="{{ buttonId }}"
|
||||
lang="{{ lang }}"
|
||||
type="{{ type }}"
|
||||
size="{{ size }}"
|
||||
color="{{ color }}"
|
||||
plain="{{ plain }}"
|
||||
loading="{{ loading }}"
|
||||
disabled="{{ disabled }}"
|
||||
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="van-goods-action-button__inner custom-class"
|
||||
custom-style="{{customStyle}}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
@ -22,6 +25,8 @@
|
||||
bindcontact="onContact"
|
||||
bindopensetting="onOpenSetting"
|
||||
bindgetuserinfo="onGetUserInfo"
|
||||
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
|
||||
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
|
||||
bindgetphonenumber="onGetPhoneNumber"
|
||||
bindlaunchapp="onLaunchApp"
|
||||
>
|
||||
|
@ -4,13 +4,14 @@ var component_1 = require("../common/component");
|
||||
var button_1 = require("../mixins/button");
|
||||
var link_1 = require("../mixins/link");
|
||||
(0, component_1.VantComponent)({
|
||||
classes: ['icon-class', 'text-class'],
|
||||
classes: ['icon-class', 'text-class', 'info-class'],
|
||||
mixins: [link_1.link, button_1.button],
|
||||
props: {
|
||||
text: String,
|
||||
dot: Boolean,
|
||||
info: String,
|
||||
icon: String,
|
||||
size: String,
|
||||
color: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
|
@ -27,11 +27,15 @@
|
||||
name="{{ icon }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
size="{{ size }}"
|
||||
color="{{ color }}"
|
||||
class-prefix="{{ classPrefix }}"
|
||||
class="van-goods-action-icon__icon"
|
||||
custom-class="icon-class"
|
||||
info-class="info-class"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<view wx:else>
|
||||
<slot name="icon" />
|
||||
</view>
|
||||
<text class="text-class">{{ text }}</text>
|
||||
</van-button>
|
||||
|
@ -2,6 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
(0, component_1.VantComponent)({
|
||||
classes: ['info-class'],
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
|
@ -9,7 +9,7 @@
|
||||
wx:if="{{ info !== null || dot }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
custom-class="van-icon__info"
|
||||
custom-class="van-icon__info info-class"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ computed.isImage(name) }}"
|
||||
|
@ -9,6 +9,10 @@ function isImage(name) {
|
||||
function rootClass(data) {
|
||||
var classes = ['custom-class'];
|
||||
|
||||
if (data.classPrefix !== 'van-icon') {
|
||||
classes.push('van-icon--custom')
|
||||
}
|
||||
|
||||
if (data.classPrefix != null) {
|
||||
classes.push(data.classPrefix);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -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();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ exports.button = Behavior({
|
||||
externalClasses: ['hover-class'],
|
||||
properties: {
|
||||
id: String,
|
||||
buttonId: String,
|
||||
lang: String,
|
||||
businessId: Number,
|
||||
sessionFrom: String,
|
||||
@ -31,6 +32,9 @@ exports.button = Behavior({
|
||||
onGetPhoneNumber: function (event) {
|
||||
this.triggerEvent('getphonenumber', event.detail);
|
||||
},
|
||||
onGetRealTimePhoneNumber: function (event) {
|
||||
this.triggerEvent('getrealtimephonenumber', event.detail);
|
||||
},
|
||||
onError: function (event) {
|
||||
this.triggerEvent('error', event.detail);
|
||||
},
|
||||
@ -40,6 +44,9 @@ exports.button = Behavior({
|
||||
onOpenSetting: function (event) {
|
||||
this.triggerEvent('opensetting', event.detail);
|
||||
},
|
||||
onAgreePrivacyAuthorization: function (event) {
|
||||
this.triggerEvent('agreeprivacyauthorization', event.detail);
|
||||
},
|
||||
onChooseAvatar: function (event) {
|
||||
this.triggerEvent('chooseavatar', event.detail);
|
||||
},
|
||||
|
@ -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'] });
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user