Compare commits

...

105 Commits

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

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

* fix: lint

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 19:53:33 +08:00
johnsonwong666
d1f505b8e8
feat(Upload): support mix mediaType #5690 2024-01-15 19:53:05 +08:00
johnsonwong666
19083a327c
fix(Transition): fix transition event sequence (#5699) 2024-01-15 19:47:25 +08:00
landluck
f2ff0e7b48 docs(changelog): @vant/weapp 1.11.2 2023-12-05 17:30:59 +08:00
landluck
d0610c09ac release: 1.11.2 2023-12-05 17:24:14 +08:00
landluck
c3ae27b4b0 build: compile 1.11.2 2023-12-05 17:24:09 +08:00
Yin Fan(尹凡)
d869a8149f
docs(area): columns-num only support number. (#5631) 2023-12-05 17:20:53 +08:00
johnsonwong666
864a890e83
fix(Dialog、goods-action-button): fix getRealTimePhoneNumber callback (#5633) 2023-12-05 17:19:40 +08:00
dependabot[bot]
1d0600cece
build(deps-dev): bump vue from 3.3.7 to 3.3.9 (#5644)
Bumps [vue](https://github.com/vuejs/core) from 3.3.7 to 3.3.9.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.3.7...v3.3.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-05 17:16:51 +08:00
dependabot[bot]
5b7dc9a4ab
build(deps-dev): bump @babel/preset-typescript from 7.23.2 to 7.23.3 (#5645)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.23.2 to 7.23.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.3/packages/babel-preset-typescript)

---
updated-dependencies:
- dependency-name: "@babel/preset-typescript"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-05 17:16:27 +08:00
cyhwinner
eeea4a8434
feat: 当前组件引入wxs文件 (#5650)
Co-authored-by: mobai <chenyuehan@youzan.com>
2023-12-05 17:15:22 +08:00
johnsonwong666
f98cf75027
fix(Upload): fix image upload in wxwork (#5581) 2023-11-06 10:08:22 +08:00
dependabot[bot]
3e6e157c6a
build(deps-dev): bump @babel/preset-typescript from 7.23.0 to 7.23.2 (#5614)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.23.0 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-preset-typescript)

---
updated-dependencies:
- dependency-name: "@babel/preset-typescript"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 10:07:12 +08:00
dependabot[bot]
8af9924056
build(deps-dev): bump @vant/icons from 3.0.1 to 3.0.2 (#5615)
Bumps [@vant/icons](https://github.com/vant-ui/vant/tree/HEAD/packages/vant-icons) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/vant-ui/vant/releases)
- [Changelog](https://github.com/youzan/vant/blob/main/packages/vant-icons/CHANGELOG.md)
- [Commits](https://github.com/vant-ui/vant/commits/v3.0.2/packages/vant-icons)

---
updated-dependencies:
- dependency-name: "@vant/icons"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 10:07:00 +08:00
dependabot[bot]
05ec5e2526
build(deps-dev): bump vue from 3.3.4 to 3.3.7 (#5616)
Bumps [vue](https://github.com/vuejs/core) from 3.3.4 to 3.3.7.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.3.4...v3.3.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 10:06:49 +08:00
dependabot[bot]
7d438e2843
build(deps-dev): bump miniprogram-api-typings from 3.12.0 to 3.12.1 (#5617)
Bumps [miniprogram-api-typings](https://github.com/wechat-miniprogram/api-typings) from 3.12.0 to 3.12.1.
- [Changelog](https://github.com/wechat-miniprogram/api-typings/blob/master/CHANGELOG.md)
- [Commits](https://github.com/wechat-miniprogram/api-typings/compare/v3.12.0...v3.12.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 10:06:35 +08:00
dependabot[bot]
3e9cdcfd7c
build(deps-dev): bump @babel/preset-typescript from 7.22.5 to 7.23.0 (#5574)
Bumps [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) from 7.22.5 to 7.23.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.0/packages/babel-preset-typescript)

---
updated-dependencies:
- dependency-name: "@babel/preset-typescript"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-31 19:23:49 +08:00
landluck
36d0add734 docs(changelog): @vant/weapp 1.11.1 2023-10-11 10:16:32 +08:00
landluck
27979cf894 release: 1.11.1 2023-10-10 20:55:59 +08:00
landluck
98874a155c build: compile 1.11.1 2023-10-10 20:55:57 +08:00
landluck
14b97ead79
feat(icon): update @vant/icon to v3.0.1 (#5583) 2023-10-10 20:55:08 +08:00
landluck
b936371007 docs(changelog): @vant/weapp 1.11.0 2023-09-18 10:28:27 +08:00
landluck
1939b76a04 release: 1.11.0 2023-09-18 10:23:01 +08:00
landluck
be99bd3bd3 build: compile 1.11.0 2023-09-18 10:22:56 +08:00
landluck
bc649cff58
feat(icon): update @vant/icon to 3.0.0 (#5561) 2023-09-18 10:21:44 +08:00
jimifish
42447bb87c
fix(van-notice-bar): notice-bar early vanished when delay and scrollable were set (#5547) 2023-09-12 16:38:43 +08:00
johnsonwong666
f330cf2a34
fix(calendar): fix calendar reset miss default Date (#5546) 2023-09-11 17:22:43 +08:00
johnsonwong666
7423e18ae3
docs(skeleton): fix custom class doc miss (#5548) 2023-09-11 16:37:56 +08:00
dependabot[bot]
8ce21a6446
build(deps-dev): bump miniprogram-api-typings from 3.10.0 to 3.12.0 (#5539)
Bumps [miniprogram-api-typings](https://github.com/wechat-miniprogram/api-typings) from 3.10.0 to 3.12.0.
- [Changelog](https://github.com/wechat-miniprogram/api-typings/blob/master/CHANGELOG.md)
- [Commits](https://github.com/wechat-miniprogram/api-typings/compare/3.10.0...v3.12.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 10:00:54 +08:00
dependabot[bot]
18ffa1891d
build(deps-dev): bump @babel/plugin-transform-modules-commonjs (#5541)
Bumps [@babel/plugin-transform-modules-commonjs](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-modules-commonjs) from 7.22.5 to 7.22.11.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.11/packages/babel-plugin-transform-modules-commonjs)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 10:00:23 +08:00
landluck
6dd89841a8 docs(changelog): @vant/weapp 1.10.25 2023-08-30 14:48:02 +08:00
landluck
3da43a131c release: 1.10.25 2023-08-30 14:43:42 +08:00
landluck
3e06aa4e89 build: compile 1.10.25 2023-08-30 14:43:39 +08:00
johnsonwong666
fd41bd823a
feat(button): add button-id prop & agreePrivacyAuthorization event support (#5533) 2023-08-30 14:41:05 +08:00
johnsonwong666
b9dea4fd16
docs: update_slider_docs (#5534) 2023-08-30 11:10:06 +08:00
landluck
de8d8359f3 docs(changelog): @vant/weapp 1.10.24 2023-08-25 10:42:24 +08:00
landluck
48a0bf0351 release: 1.10.24 2023-08-25 10:37:40 +08:00
landluck
511adf7f5d build: compile 1.10.24 2023-08-25 10:37:36 +08:00
johnsonwong666
d692b708af
fix: add observer for limit date change (#5520) 2023-08-22 10:05:08 +08:00
johnsonwong666
610ce18859
feat: add agreePrivacyAuthorization button open type (#5527) 2023-08-22 10:04:25 +08:00
landluck
6d6d6d736b docs(changelog): @vant/weapp 1.10.23 2023-07-28 14:16:33 +08:00
landluck
fd95792040 release: 1.10.23 2023-07-28 14:14:14 +08:00
landluck
ea8f92f919 build: compile 1.10.23 2023-07-28 14:14:11 +08:00
landluck
88a36b5647
feat(dialog): add confirm/cancel button slot support (#5502) 2023-07-27 20:52:22 +08:00
zjy4fun
f975d2b37d
feat(Search): cursor-spacing props for search component (#5498) 2023-07-27 20:38:20 +08:00
landluck
589be648f2 docs(changelog): @vant/weapp 1.10.22 2023-07-24 10:07:50 +08:00
landluck
713f694aa0 release: 1.10.22 2023-07-24 10:03:51 +08:00
landluck
c99f464360 build: compile 1.10.22 2023-07-24 10:03:48 +08:00
dependabot[bot]
e0abf6effc
build(deps): bump word-wrap from 1.2.3 to 1.2.4 (#5492)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 10:00:31 +08:00
johnsonwong666
78c518bae8
fix(GoodsAction): add block for slot (#5496) 2023-07-24 10:00:02 +08:00
johnsonwong666
9ead748d91
fix(sticky): fix error in transition & sticky (#5483) 2023-07-17 09:54:00 +08:00
landluck
8021e7cdfd
fix(field): fix field error message style (#5482) 2023-07-11 20:53:52 +08:00
dependabot[bot]
dec405d770
build(deps): bump semver from 5.7.1 to 5.7.2 (#5480)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 20:49:38 +08:00
landluck
e67ff09e37 docs(changelog): @vant/weapp 1.10.21 2023-07-10 21:13:37 +08:00
landluck
4756994212 release: 1.10.21 2023-07-10 21:09:29 +08:00
landluck
799a06379d build: compile 1.10.21 2023-07-10 21:09:25 +08:00
johnsonwong666
917ab22907
feat(dialog): add extra custom class (#5478) 2023-07-10 21:07:54 +08:00
johnsonwong666
7498ed12c3
fix(uploader): fix chooseImage error in PC (#5477) 2023-07-10 19:17:54 +08:00
landluck
f197c5f3c3
feat(field): expand click area support (#5479) 2023-07-10 17:49:20 +08:00
johnsonwong666
f26de0cbb0
feat(Upload): add videoFit prop (#5475) 2023-07-10 14:52:19 +08:00
landluck
8309c27297
feat(field): add custom-class prop support (#5476) 2023-07-10 14:50:57 +08:00
landluck
fa04172e5b
docs: add demo app warning (#5472) 2023-07-06 15:00:12 +08:00
johnsonwong666
b005b41c4e
feat(calendar): allow default date to be null (#5395) 2023-07-05 13:54:40 +08:00
landluck
2c7629fe07
feat(button): add getRealtimePhoneNumber support (#5471) 2023-07-05 13:53:44 +08:00
landluck
bc3d307c4d docs(changelog): @vant/weapp 1.10.20 2023-07-03 19:09:22 +08:00
169 changed files with 3874 additions and 4205 deletions

View File

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

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

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

@ -11,9 +11,9 @@
</p> </p>
<p align="center"> <p align="center">
🔥 <a href="https://vant-contrib.gitee.io/vant-weapp">文档网站(国内)</a> 🔥 <a href="https://vant.pro/vant-weapp/">文档网站(国内)</a>
&nbsp; &nbsp;
🌈 <a href="https://youzan.github.io/vant-weapp">文档网站GitHub</a> 🔥 <a href="https://vant-ui.github.io/vant-weapp/">文档网站GitHub</a>
&nbsp; &nbsp;
🚀 <a href="https://github.com/vant-ui/vant" target="_blank">Vue 版</a> 🚀 <a href="https://github.com/vant-ui/vant" target="_blank">Vue 版</a>
</p> </p>
@ -24,11 +24,11 @@
Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。 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;" > <img src="https://img.yzcdn.cn/vant-weapp/qrcode-201808101114.jpg" width="200" height="200" style="margin-top: 10px;" >
@ -99,9 +99,11 @@ Vant Weapp 最低支持到小程序基础库 2.6.5 版本。
## 链接 ## 链接
- [文档网站GitHub](https://vant-ui.github.io/vant-weapp/)
- [文档网站(国内)](https://vant.pro/vant-weapp/)
- [意见反馈](https://github.com/youzan/vant-weapp/issues) - [意见反馈](https://github.com/youzan/vant-weapp/issues)
- [设计资源](https://vant-contrib.gitee.io/vant/#/zh-CN/design) - [设计资源](https://vant-ui.github.io/vant/#/zh-CN/design)
- [更新日志](https://vant-contrib.gitee.io/vant-weapp/#/changelog) - [更新日志](https://vant-ui.github.io/vant-weapp/#/changelog)
- [官方示例](https://github.com/vant-ui/vant-demo) - [官方示例](https://github.com/vant-ui/vant-demo)
## 核心团队 ## 核心团队

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<button <button
id="{{ id }}" id="{{ id || buttonId }}"
data-detail="{{ dataset }}" 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' : '' }}" 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'}}" hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
@ -22,6 +22,8 @@
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
binderror="onError" binderror="onError"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"

View File

@ -1,3 +1,5 @@
<wxs src="./index.wxs" module="computed" />
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-calendar"> <view class="van-calendar">
<header <header
title="{{ title }}" title="{{ title }}"

View File

@ -40,6 +40,7 @@ VantComponent({
}, },
defaultDate: { defaultDate: {
type: null, type: null,
value: getToday().getTime(),
observer(val) { observer(val) {
this.setData({ currentDate: val }); this.setData({ currentDate: val });
this.scrollIntoView(); this.scrollIntoView();
@ -112,12 +113,24 @@ VantComponent({
value: 0, value: 0,
}, },
readonly: Boolean, readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
}, },
data: { data: {
subtitle: '', subtitle: '',
currentDate: null, currentDate: null,
scrollIntoView: '', scrollIntoView: '',
}, },
watch: {
minDate() {
this.initRect();
},
maxDate() {
this.initRect();
},
},
created() { created() {
this.setData({ this.setData({
currentDate: this.getInitialDate(this.data.defaultDate), currentDate: this.getInitialDate(this.data.defaultDate),
@ -131,7 +144,7 @@ VantComponent({
}, },
methods: { methods: {
reset() { reset() {
this.setData({ currentDate: this.getInitialDate() }); this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
this.scrollIntoView(); this.scrollIntoView();
}, },
initRect() { initRect() {
@ -164,6 +177,8 @@ VantComponent({
}, },
getInitialDate(defaultDate = null) { getInitialDate(defaultDate = null) {
const { type, minDate, maxDate, allowSameDay } = this.data; const { type, minDate, maxDate, allowSameDay } = this.data;
if (!defaultDate)
return [];
const now = getToday().getTime(); const now = getToday().getTime();
if (type === 'range') { if (type === 'range') {
if (!Array.isArray(defaultDate)) { if (!Array.isArray(defaultDate)) {
@ -190,6 +205,8 @@ VantComponent({
scrollIntoView() { scrollIntoView() {
requestAnimationFrame(() => { requestAnimationFrame(() => {
const { currentDate, type, show, poppable, minDate, maxDate } = this.data; const { currentDate, type, show, poppable, minDate, maxDate } = this.data;
if (!currentDate)
return;
// @ts-ignore // @ts-ignore
const targetDate = type === 'single' ? currentDate : currentDate[0]; const targetDate = type === 'single' ? currentDate : currentDate[0];
const displayed = show || !poppable; const displayed = show || !poppable;

View File

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

View File

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

View File

@ -1,7 +1,8 @@
<wxs src="./index.wxs" module="utils" /> <wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header"> <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 <van-icon
wx:if="{{ closeable }}" wx:if="{{ closeable }}"
name="{{ closeIcon }}" name="{{ closeIcon }}"

View File

@ -93,6 +93,8 @@ VantComponent({
const { color, size } = this.data; const { color, size } = this.data;
if (isObj(color)) { if (isObj(color)) {
return this.getContext().then((context) => { return this.getContext().then((context) => {
if (!context)
return;
const LinearColor = context.createLinearGradient(size, 0, 0, 0); const LinearColor = context.createLinearGradient(size, 0, 0, 0);
Object.keys(color) Object.keys(color)
.sort((a, b) => parseFloat(a) - parseFloat(b)) .sort((a, b) => parseFloat(a) - parseFloat(b))
@ -134,6 +136,8 @@ VantComponent({
drawCircle(currentValue) { drawCircle(currentValue) {
const { size } = this.data; const { size } = this.data;
this.getContext().then((context) => { this.getContext().then((context) => {
if (!context)
return;
context.clearRect(0, 0, size, size); context.clearRect(0, 0, size, size);
this.renderLayerCircle(context); this.renderLayerCircle(context);
const formatValue = format(currentValue); const formatValue = format(currentValue);

View File

@ -17,3 +17,5 @@ export declare function toPromise(promiseLike: Promise<unknown> | unknown): Prom
export declare function addNumber(num1: any, num2: any): number; export declare function addNumber(num1: any, num2: any): number;
export declare const clamp: (num: any, min: any, max: 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 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;

View File

@ -1,5 +1,5 @@
import { isDef, isNumber, isPlainObject, isPromise } from './validator'; import { isDef, isNumber, isPlainObject, isPromise } from './validator';
import { canIUseGroupSetData, canIUseNextTick } from './version'; import { canIUseGroupSetData, canIUseNextTick, getSystemInfoSync, } from './version';
export { isDef } from './validator'; export { isDef } from './validator';
export { getSystemInfoSync } from './version'; export { getSystemInfoSync } from './version';
export function range(num, min, max) { export function range(num, min, max) {
@ -81,3 +81,6 @@ export function getCurrentPage() {
const pages = getCurrentPages(); const pages = getCurrentPages();
return pages[pages.length - 1]; return pages[pages.length - 1];
} }
export const isPC = ['mac', 'windows'].includes(getSystemInfoSync().platform);
// 是否企业微信
export const isWxWork = getSystemInfoSync().environment === 'wxwork';

View File

@ -1,5 +1,10 @@
/// <reference types="miniprogram-api-typings" /> /// <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 canIUseModel(): boolean;
export declare function canIUseFormFieldButton(): boolean; export declare function canIUseFormFieldButton(): boolean;
export declare function canIUseAnimate(): boolean; export declare function canIUseAnimate(): boolean;
@ -7,3 +12,4 @@ export declare function canIUseGroupSetData(): boolean;
export declare function canIUseNextTick(): boolean; export declare function canIUseNextTick(): boolean;
export declare function canIUseCanvas2d(): boolean; export declare function canIUseCanvas2d(): boolean;
export declare function canIUseGetUserProfile(): boolean; export declare function canIUseGetUserProfile(): boolean;
export {};

View File

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

10
dist/dialog/index.js vendored
View File

@ -4,6 +4,7 @@ import { GRAY, RED } from '../common/color';
import { toPromise } from '../common/utils'; import { toPromise } from '../common/utils';
VantComponent({ VantComponent({
mixins: [button], mixins: [button],
classes: ['cancle-button-class', 'confirm-button-class'],
props: { props: {
show: { show: {
type: Boolean, type: Boolean,
@ -17,14 +18,17 @@ VantComponent({
type: String, type: String,
value: 'default', value: 'default',
}, },
useSlot: Boolean, confirmButtonId: String,
className: String, className: String,
customStyle: String, customStyle: String,
asyncClose: Boolean, asyncClose: Boolean,
messageAlign: String, messageAlign: String,
beforeClose: null, beforeClose: null,
overlayStyle: String, overlayStyle: String,
useSlot: Boolean,
useTitleSlot: Boolean, useTitleSlot: Boolean,
useConfirmButtonSlot: Boolean,
useCancelButtonSlot: Boolean,
showCancelButton: Boolean, showCancelButton: Boolean,
closeOnClickOverlay: Boolean, closeOnClickOverlay: Boolean,
confirmButtonOpenType: String, confirmButtonOpenType: String,
@ -61,6 +65,10 @@ VantComponent({
type: String, type: String,
value: 'scale', value: 'scale',
}, },
rootPortal: {
type: Boolean,
value: false,
},
}, },
data: { data: {
loading: { loading: {

View File

@ -9,6 +9,7 @@
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}" custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}" overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay" bind:close="onClickOverlay"
> >
<view <view
@ -33,7 +34,7 @@
size="large" size="large"
loading="{{ loading.cancel }}" loading="{{ loading.cancel }}"
class="van-dialog__button van-hairline--right" class="van-dialog__button van-hairline--right"
custom-class="van-dialog__cancel" custom-class="van-dialog__cancel cancle-button-class"
custom-style="color: {{ cancelButtonColor }}" custom-style="color: {{ cancelButtonColor }}"
bind:click="onCancel" bind:click="onCancel"
> >
@ -44,9 +45,9 @@
size="large" size="large"
class="van-dialog__button" class="van-dialog__button"
loading="{{ loading.confirm }}" loading="{{ loading.confirm }}"
custom-class="van-dialog__confirm" custom-class="van-dialog__confirm confirm-button-class"
custom-style="color: {{ confirmButtonColor }}" custom-style="color: {{ confirmButtonColor }}"
button-id="{{ confirmButtonId }}"
open-type="{{ confirmButtonOpenType }}" open-type="{{ confirmButtonOpenType }}"
lang="{{ lang }}" lang="{{ lang }}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
@ -56,7 +57,8 @@
send-message-img="{{ sendMessageImg }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
bind:click="onConfirm" bind:click="onConfirm"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
@ -70,44 +72,54 @@
</van-goods-action> </van-goods-action>
<view wx:elif="{{ showCancelButton || showConfirmButton }}" class="van-hairline--top van-dialog__footer"> <view wx:elif="{{ showCancelButton || showConfirmButton }}" class="van-hairline--top van-dialog__footer">
<van-button <block wx:if="{{ showCancelButton }}">
wx:if="{{ showCancelButton }}" <slot wx:if="{{ useCancelButtonSlot }}" name="cancel-button" />
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 }}"
open-type="{{ confirmButtonOpenType }}" <van-button
lang="{{ lang }}" wx:else
business-id="{{ businessId }}" size="large"
session-from="{{ sessionFrom }}" loading="{{ loading.cancel }}"
send-message-title="{{ sendMessageTitle }}" class="van-dialog__button van-hairline--right"
send-message-path="{{ sendMessagePath }}" custom-class="van-dialog__cancel cancle-button-class"
send-message-img="{{ sendMessageImg }}" custom-style="color: {{ cancelButtonColor }}"
show-message-card="{{ showMessageCard }}" bind:click="onCancel"
app-parameter="{{ appParameter }}" >
{{ cancelButtonText }}
</van-button>
</block>
bind:click="onConfirm" <block wx:if="{{ showConfirmButton }}">
bindgetuserinfo="onGetUserInfo" <slot wx:if="{{ useConfirmButtonSlot }}" name="confirm-button" />
bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber" <van-button
binderror="onError" wx:else
bindlaunchapp="onLaunchApp" size="large"
bindopensetting="onOpenSetting" class="van-dialog__button"
> loading="{{ loading.confirm }}"
{{ confirmButtonText }} custom-class="van-dialog__confirm confirm-button-class"
</van-button> 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> </view>
</van-popup> </van-popup>

17
dist/field/index.js vendored
View File

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

14
dist/field/index.wxml vendored
View File

@ -13,12 +13,12 @@
title-style="margin-right: 12px;" title-style="margin-right: 12px;"
custom-style="{{ customStyle }}" custom-style="{{ customStyle }}"
arrow-direction="{{ arrowDirection }}" arrow-direction="{{ arrowDirection }}"
custom-class="van-field" custom-class="custom-class van-field"
> >
<slot name="left-icon" slot="icon" /> <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 }} {{ label }}
</view> </label>
<slot wx:else name="label" slot="title" /> <slot wx:else name="label" slot="title" />
<view class="{{ utils.bem('field__body', [type]) }}"> <view class="{{ utils.bem('field__body', [type]) }}">
<view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput"> <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
@ -47,10 +47,10 @@
<slot name="button" /> <slot name="button" />
</view> </view>
</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 class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
</view> </label>
<view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}"> <label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
{{ errorMessage }} {{ errorMessage }}
</view> </label>
</van-cell> </van-cell>

View File

@ -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)}

View File

@ -1,4 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<input <input
id="{{ name }}"
class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class" class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
type="{{ type }}" type="{{ type }}"
focus="{{ focus }}" focus="{{ focus }}"
@ -25,4 +27,5 @@
bindfocus="onFocus" bindfocus="onFocus"
bindconfirm="onConfirm" bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange" bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/> />

10
dist/field/props.js vendored
View File

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

View File

@ -1,4 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<textarea <textarea
id="{{ name }}"
class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class" class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
fixed="{{ fixed }}" fixed="{{ fixed }}"
focus="{{ focus }}" focus="{{ focus }}"

View File

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

View File

@ -1,6 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<van-button <van-button
id="{{ id }}" id="{{ id }}"
button-id="{{ buttonId }}"
lang="{{ lang }}" lang="{{ lang }}"
type="{{ type }}" type="{{ type }}"
size="{{ size }}" size="{{ size }}"
@ -10,7 +11,8 @@
disabled="{{ disabled }}" disabled="{{ disabled }}"
open-type="{{ openType }}" open-type="{{ openType }}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}" 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 }}" business-id="{{ businessId }}"
session-from="{{ sessionFrom }}" session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
@ -23,6 +25,8 @@
bindcontact="onContact" bindcontact="onContact"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
> >

View File

@ -34,6 +34,8 @@
custom-class="icon-class" custom-class="icon-class"
info-class="info-class" info-class="info-class"
/> />
<slot wx:else name="icon" /> <view wx:else>
<slot name="icon" />
</view>
<text class="text-class">{{ text }}</text> <text class="text-class">{{ text }}</text>
</van-button> </van-button>

File diff suppressed because one or more lines are too long

15
dist/mixins/basic.js vendored
View File

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

View File

@ -3,6 +3,7 @@ export const button = Behavior({
externalClasses: ['hover-class'], externalClasses: ['hover-class'],
properties: { properties: {
id: String, id: String,
buttonId: String,
lang: String, lang: String,
businessId: Number, businessId: Number,
sessionFrom: String, sessionFrom: String,
@ -28,6 +29,9 @@ export const button = Behavior({
onGetPhoneNumber(event) { onGetPhoneNumber(event) {
this.triggerEvent('getphonenumber', event.detail); this.triggerEvent('getphonenumber', event.detail);
}, },
onGetRealTimePhoneNumber(event) {
this.triggerEvent('getrealtimephonenumber', event.detail);
},
onError(event) { onError(event) {
this.triggerEvent('error', event.detail); this.triggerEvent('error', event.detail);
}, },
@ -37,6 +41,9 @@ export const button = Behavior({
onOpenSetting(event) { onOpenSetting(event) {
this.triggerEvent('opensetting', event.detail); this.triggerEvent('opensetting', event.detail);
}, },
onAgreePrivacyAuthorization(event) {
this.triggerEvent('agreeprivacyauthorization', event.detail);
},
onChooseAvatar(event) { onChooseAvatar(event) {
this.triggerEvent('chooseavatar', event.detail); this.triggerEvent('chooseavatar', event.detail);
}, },

View File

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

View File

@ -103,7 +103,7 @@ VantComponent({
}); });
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
this.scroll(); this.scroll();
}, this.duration); }, this.duration + this.data.delay);
}, },
onClickIcon(event) { onClickIcon(event) {
if (this.data.mode === 'closeable') { if (this.data.mode === 'closeable') {

View File

@ -1,3 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view <view
wx:if="{{ inited }}" wx:if="{{ inited }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}" class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"

View File

@ -53,6 +53,10 @@ VantComponent({
type: String, type: String,
value: 'clear', value: 'clear',
}, },
cursorSpacing: {
type: Number,
value: 0,
},
}, },
methods: { methods: {
onChange(event) { onChange(event) {

View File

@ -28,6 +28,7 @@
input-class="input-class" input-class="input-class"
placeholder="{{ placeholder }}" placeholder="{{ placeholder }}"
placeholder-style="{{ placeholderStyle }}" placeholder-style="{{ placeholderStyle }}"
cursor-spacing="{{ cursorSpacing }}"
custom-style="padding: 5px 10px 5px 0; background-color: transparent;" custom-style="padding: 5px 10px 5px 0; background-color: transparent;"
bind:blur="onBlur" bind:blur="onBlur"
bind:focus="onFocus" bind:focus="onFocus"

View File

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

View File

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

View File

@ -128,12 +128,7 @@ VantComponent({
if (value === '') { if (value === '') {
return; return;
} }
let formatted = this.filter(value); let formatted = this.format(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)}`;
}
this.emitChange(formatted); this.emitChange(formatted);
}, },
emitChange(value) { emitChange(value) {

14
dist/sticky/index.js vendored
View File

@ -57,10 +57,8 @@ VantComponent({
} }
this.scrollTop = scrollTop || this.scrollTop; this.scrollTop = scrollTop || this.scrollTop;
if (typeof container === 'function') { if (typeof container === 'function') {
Promise.all([ Promise.all([getRect(this, ROOT_ELEMENT), this.getContainerRect()])
getRect(this, ROOT_ELEMENT), .then(([root, container]) => {
this.getContainerRect(),
]).then(([root, container]) => {
if (offsetTop + root.height > container.height + container.top) { if (offsetTop + root.height > container.height + container.top) {
this.setDataAfterDiff({ this.setDataAfterDiff({
fixed: false, fixed: false,
@ -77,11 +75,12 @@ VantComponent({
else { else {
this.setDataAfterDiff({ fixed: false, transform: 0 }); this.setDataAfterDiff({ fixed: false, transform: 0 });
} }
}); })
.catch(() => { });
return; return;
} }
getRect(this, ROOT_ELEMENT).then((root) => { getRect(this, ROOT_ELEMENT).then((root) => {
if (!isDef(root)) { if (!isDef(root) || (!root.width && !root.height)) {
return; return;
} }
if (offsetTop >= root.top) { if (offsetTop >= root.top) {
@ -112,6 +111,9 @@ VantComponent({
}, },
getContainerRect() { getContainerRect() {
const nodesRef = this.data.container(); const nodesRef = this.data.container();
if (!nodesRef) {
return Promise.reject(new Error('not found container'));
}
return new Promise((resolve) => nodesRef.boundingClientRect(resolve).exec()); return new Promise((resolve) => nodesRef.boundingClientRect(resolve).exec());
}, },
}, },

View File

@ -1,7 +1,7 @@
import { VantComponent } from '../common/component'; 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 { isBoolean, isPromise } from '../common/validator';
import { imageProps, mediaProps, messageFileProps, videoProps } from './shared';
import { chooseFile, isImageFile, isVideoFile } from './utils';
VantComponent({ VantComponent({
props: Object.assign(Object.assign(Object.assign(Object.assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: { props: Object.assign(Object.assign(Object.assign(Object.assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null, type: null,
@ -34,6 +34,9 @@ VantComponent({
}, previewFullImage: { }, previewFullImage: {
type: Boolean, type: Boolean,
value: true, value: true,
}, videoFit: {
type: String,
value: 'contain',
}, imageFit: { }, imageFit: {
type: String, type: String,
value: 'scaleToFill', value: 'scaleToFill',

View File

@ -28,6 +28,8 @@
title="{{ item.name || ('视频' + index) }}" title="{{ item.name || ('视频' + index) }}"
poster="{{ item.thumb }}" poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}" autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image" class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}" style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}" data-index="{{ index }}"

View File

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

View File

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

View File

@ -1,4 +1,4 @@
import { pickExclude } from '../common/utils'; import { pickExclude, isPC, isWxWork } from '../common/utils';
import { isImageUrl, isVideoUrl } from '../common/validator'; import { isImageUrl, isVideoUrl } from '../common/validator';
export function isImageFile(item) { export function isImageFile(item) {
if (item.isImage != null) { if (item.isImage != null) {
@ -25,7 +25,7 @@ export function isVideoFile(item) {
return false; return false;
} }
function formatImage(res) { function formatImage(res) {
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { type: 'image', url: item.tempFilePath, thumb: item.tempFilePath }))); 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) { function formatVideo(res) {
return [ return [
@ -33,7 +33,7 @@ function formatVideo(res) {
]; ];
} }
function formatMedia(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) { function formatFile(res) {
return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { url: item.path }))); return res.tempFiles.map((item) => (Object.assign(Object.assign({}, pickExclude(item, ['path'])), { url: item.path })));
@ -42,16 +42,27 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration,
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
switch (accept) { switch (accept) {
case 'image': case 'image':
wx.chooseMedia({ if (isPC || isWxWork) {
count: multiple ? Math.min(maxCount, 9) : 1, wx.chooseImage({
mediaType: ['image'], count: multiple ? Math.min(maxCount, 9) : 1,
sourceType: capture, sourceType: capture,
maxDuration, sizeType,
sizeType, success: (res) => resolve(formatImage(res)),
camera, fail: reject,
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; break;
case 'media': case 'media':
wx.chooseMedia({ wx.chooseMedia({

View File

@ -1,4 +1,183 @@
# 更新日志 # 更新日志
### [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) ### [v1.10.19](https://github.com/youzan/vant-weapp/compare/v1.10.18...v1.10.19)
`2023-05-19` `2023-05-19`
@ -15,10 +194,12 @@
`2023-05-08` `2023-05-08`
**Bug Fixes** **Bug Fixes**
- steps: 修复在竖向模式下 icon 被覆盖的问题 [#5329](https://github.com/youzan/vant-weapp/issues/5329) - steps: 修复在竖向模式下 icon 被覆盖的问题 [#5329](https://github.com/youzan/vant-weapp/issues/5329)
- tabs: 修复 tab 较多时slot 无法正常显示问题 [#4700](https://github.com/youzan/vant-weapp/issues/4700) - tabs: 修复 tab 较多时slot 无法正常显示问题 [#4700](https://github.com/youzan/vant-weapp/issues/4700)
**Feature** **Feature**
- field: input/change 事件增加 callback 参数 [#5345](https://github.com/youzan/vant-weapp/issues/5345) - 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) - goods-action: goods-action-button 增加 size 属性 [#5347](https://github.com/youzan/vant-weapp/issues/5347)
@ -78,15 +259,14 @@
- overlay: 增加 root-portal 属性支持 [#5255](https://github.com/youzan/vant-weapp/issues/5255) - overlay: 增加 root-portal 属性支持 [#5255](https://github.com/youzan/vant-weapp/issues/5255)
- popup: 增加 root-portal 属性支持 [#5254](https://github.com/youzan/vant-weapp/issues/5254) - 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) ### [v1.10.13](https://github.com/youzan/vant-weapp/compare/v1.10.12...v1.10.13)
`2023-02-13` `2023-02-13`
**Bug Fixes** **Bug Fixes**
- calendar: 修复calendar组件安全区域传参未传递给popup组件的问题 [db7957](https://github.com/youzan/vant-weapp/commit/db79570d98537db669730aa66d3fb3932ded4737) - 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) - 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: 修复 always-embed 申明两次警告问题 [#5231](https://github.com/youzan/vant-weapp/issues/5231)
- stepper: 修复 onblur 时在值变更的情况下 change 事件没有触发 [#5227](https://github.com/youzan/vant-weapp/issues/5227) - stepper: 修复 onblur 时在值变更的情况下 change 事件没有触发 [#5227](https://github.com/youzan/vant-weapp/issues/5227)
@ -97,7 +277,6 @@
- tabbar-item: 增加 url link-type 属性支持 [#5232](https://github.com/youzan/vant-weapp/issues/5232) - 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) - 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) ### [v1.10.12](https://github.com/youzan/vant-weapp/compare/v1.10.11...v1.10.12)
`2023-01-16` `2023-01-16`
@ -105,17 +284,17 @@
**Bug Fixes** **Bug Fixes**
- calendar: 修复在 allow-same-day 情况下初始不能选择同一天 [#5193](https://github.com/youzan/vant-weapp/issues/5193) - 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** **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** **Feature**
- dropdown-menu: 增加 use-before-toggle 属性支持 [#5190](https://github.com/youzan/vant-weapp/issues/5190) - 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) - 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) ### [v1.10.11](https://github.com/youzan/vant-weapp/compare/v1.10.10...v1.10.11)
`2023-01-03` `2023-01-03`
@ -157,11 +336,13 @@
`2022-12-12` `2022-12-12`
**Bug Fixes** **Bug Fixes**
- slider: 修复文档示例值错误 [#5128](https://github.com/youzan/vant-weapp/issues/5128) - slider: 修复文档示例值错误 [#5128](https://github.com/youzan/vant-weapp/issues/5128)
- tab: 修复在开启微信工具热更新时出现堆栈溢出问题 [#5125](https://github.com/youzan/vant-weapp/issues/5125) - tab: 修复在开启微信工具热更新时出现堆栈溢出问题 [#5125](https://github.com/youzan/vant-weapp/issues/5125)
- transition: 修复页面切后台后无法触发 transition 相关组件更新 [#5131](https://github.com/youzan/vant-weapp/issues/5131) - transition: 修复页面切后台后无法触发 transition 相关组件更新 [#5131](https://github.com/youzan/vant-weapp/issues/5131)
**Feature** **Feature**
- cascader: 新增 cascader 组件 [#4992](https://github.com/youzan/vant-weapp/issues/4992) - 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) ### [v1.10.8](https://github.com/youzan/vant-weapp/compare/v1.10.7...v1.10.8)
@ -176,13 +357,12 @@
**Document** **Document**
- Calendar: 修复示例代码错误问题 [c55c78](https://github.com/youzan/vant-weapp/commit/c55c785a9ed67e0801c693d61b1e7e691bd19cf1) - 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** **Feature**
- dialog: 增加 custom-class 属性支持 [#5102](https://github.com/youzan/vant-weapp/issues/5102) - 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) ### [v1.10.7](https://github.com/youzan/vant-weapp/compare/v1.10.6...v1.10.7)
@ -193,6 +373,7 @@
- search: 增加 value 默认 props 定义 [697746](https://github.com/youzan/vant-weapp/commit/697746fb470e9e16476f3fe95c15e4448ca9d686) - search: 增加 value 默认 props 定义 [697746](https://github.com/youzan/vant-weapp/commit/697746fb470e9e16476f3fe95c15e4448ca9d686)
**Document** **Document**
- collapse: 增加 right-icon 额外使用说明 [d39b35](https://github.com/youzan/vant-weapp/commit/d39b35fc3a1d4b913d7b94bb45b3e861e3cee79e) - collapse: 增加 right-icon 额外使用说明 [d39b35](https://github.com/youzan/vant-weapp/commit/d39b35fc3a1d4b913d7b94bb45b3e861e3cee79e)
**Feature** **Feature**
@ -200,8 +381,6 @@
- action-sheet: 增加自定义样式能力支持 [#5097](https://github.com/youzan/vant-weapp/issues/5097) - action-sheet: 增加自定义样式能力支持 [#5097](https://github.com/youzan/vant-weapp/issues/5097)
- dropdown-menu: 增加多个自定义样式能力支持 [#5099](https://github.com/youzan/vant-weapp/issues/5099) - 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) ### [v1.10.6](https://github.com/youzan/vant-weapp/compare/v1.10.5...v1.10.6)
`2022-11-06` `2022-11-06`
@ -212,11 +391,11 @@
- button: 修复 button 在 disabeld 或 loading 时能触发 active 状态问题 [#5084](https://github.com/youzan/vant-weapp/issues/5084) - 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) - 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) - 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** **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) ### [v1.10.5](https://github.com/youzan/vant-weapp/compare/v1.10.4...v1.10.5)
@ -1174,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 自定义属性设计了样式定制的方案,开发者使用灵活、方便,组件维护也更简单。 微信小程序自定义组件的组件模型相当于一个简化版的 [Shadow DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom?hl=zh-CN),幸运的是,小程序也支持了 [CSS 自定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 的特性。最终,我们基于 CSS 自定义属性设计了样式定制的方案,开发者使用灵活、方便,组件维护也更简单。
从 1.0 版本开始Vant Weapp 中的所有组件都支持通过 [CSS 组定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 进行样式定制,具体使用姿势可查看[相关文档](https://youzan.github.io/vant-weapp/#/theme) 从 1.0 版本开始Vant Weapp 中的所有组件都支持通过 [CSS 组定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 进行样式定制,具体使用姿势可查看[相关文档](/vant-weapp/#/theme)
![定制主题](https://img.yzcdn.cn/public_files/2019/06/11/9a066c1a212264c7ae56065e1f13d317.png) ![定制主题](https://img.yzcdn.cn/public_files/2019/06/11/9a066c1a212264c7ae56065e1f13d317.png)

View File

@ -10,7 +10,7 @@
Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。 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://github.com/youzan/vant-weapp/issues)
- [设计资源](https://vant-contrib.gitee.io/vant/#/zh-CN/design) - [设计资源](/vant/#/zh-CN/design)
- [更新日志](https://vant-contrib.gitee.io/vant-weapp/#/changelog) - [更新日志](/vant-weapp/#/changelog)
- [官方示例](https://github.com/vant-ui/vant-demo) - [官方示例](https://github.com/vant-ui/vant-demo)
## 贡献 ## 贡献

View File

@ -25,36 +25,13 @@ npm i vant-weapp -S --production
将 app.json 中的 `"style": "v2"` 去除,小程序的[新版基础组件](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#style)强行加上了许多样式,难以覆盖,不关闭将造成部分组件样式混乱。 将 app.json 中的 `"style": "v2"` 去除,小程序的[新版基础组件](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#style)强行加上了许多样式,难以覆盖,不关闭将造成部分组件样式混乱。
### 步骤三 修改 project.config.json ### 步骤三 构建 npm 包
开发者工具创建的项目,`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**,并勾选 **使用 npm 模块** 选项,构建完成后,即可引入组件。
<img style="width: 500px;" src="https://img.yzcdn.cn/public_files/2019/08/15/fa0549210055976cb63798503611ce3d.png" /> <img style="width: 500px;" src="https://img.yzcdn.cn/public_files/2019/08/15/fa0549210055976cb63798503611ce3d.png" />
### 步骤 typescript 支持 ### 步骤四 typescript 支持
如果你使用 typescript 开发小程序,还需要做如下操作,以获得顺畅的开发体验。 如果你使用 typescript 开发小程序,还需要做如下操作,以获得顺畅的开发体验。

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<button <button
id="{{ id }}" id="{{ id || buttonId }}"
data-detail="{{ dataset }}" 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' : '' }}" 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'}}" hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
@ -22,6 +22,8 @@
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
binderror="onError" binderror="onError"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"

View File

@ -1,3 +1,5 @@
<wxs src="./index.wxs" module="computed" />
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-calendar"> <view class="van-calendar">
<header <header
title="{{ title }}" title="{{ title }}"

View File

@ -56,6 +56,7 @@ var getTime = function (date) {
}, },
defaultDate: { defaultDate: {
type: null, type: null,
value: (0, utils_1.getToday)().getTime(),
observer: function (val) { observer: function (val) {
this.setData({ currentDate: val }); this.setData({ currentDate: val });
this.scrollIntoView(); this.scrollIntoView();
@ -128,12 +129,24 @@ var getTime = function (date) {
value: 0, value: 0,
}, },
readonly: Boolean, readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
}, },
data: { data: {
subtitle: '', subtitle: '',
currentDate: null, currentDate: null,
scrollIntoView: '', scrollIntoView: '',
}, },
watch: {
minDate: function () {
this.initRect();
},
maxDate: function () {
this.initRect();
},
},
created: function () { created: function () {
this.setData({ this.setData({
currentDate: this.getInitialDate(this.data.defaultDate), currentDate: this.getInitialDate(this.data.defaultDate),
@ -147,7 +160,7 @@ var getTime = function (date) {
}, },
methods: { methods: {
reset: function () { reset: function () {
this.setData({ currentDate: this.getInitialDate() }); this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
this.scrollIntoView(); this.scrollIntoView();
}, },
initRect: function () { initRect: function () {
@ -185,6 +198,8 @@ var getTime = function (date) {
var _this = this; var _this = this;
if (defaultDate === void 0) { defaultDate = null; } if (defaultDate === void 0) { defaultDate = null; }
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay; 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(); var now = (0, utils_1.getToday)().getTime();
if (type === 'range') { if (type === 'range') {
if (!Array.isArray(defaultDate)) { if (!Array.isArray(defaultDate)) {
@ -212,6 +227,8 @@ var getTime = function (date) {
var _this = this; var _this = this;
(0, utils_2.requestAnimationFrame)(function () { (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; 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 // @ts-ignore
var targetDate = type === 'single' ? currentDate : currentDate[0]; var targetDate = type === 'single' ? currentDate : currentDate[0];
var displayed = show || !poppable; var displayed = show || !poppable;

View File

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

View File

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

View File

@ -1,7 +1,8 @@
<wxs src="./index.wxs" module="utils" /> <wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header"> <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 <van-icon
wx:if="{{ closeable }}" wx:if="{{ closeable }}"
name="{{ closeIcon }}" name="{{ closeIcon }}"

View File

@ -98,6 +98,8 @@ var STEP = 1;
var _a = this.data, color = _a.color, size = _a.size; var _a = this.data, color = _a.color, size = _a.size;
if ((0, validator_1.isObj)(color)) { if ((0, validator_1.isObj)(color)) {
return this.getContext().then(function (context) { return this.getContext().then(function (context) {
if (!context)
return;
var LinearColor = context.createLinearGradient(size, 0, 0, 0); var LinearColor = context.createLinearGradient(size, 0, 0, 0);
Object.keys(color) Object.keys(color)
.sort(function (a, b) { return parseFloat(a) - parseFloat(b); }) .sort(function (a, b) { return parseFloat(a) - parseFloat(b); })
@ -142,6 +144,8 @@ var STEP = 1;
var _this = this; var _this = this;
var size = this.data.size; var size = this.data.size;
this.getContext().then(function (context) { this.getContext().then(function (context) {
if (!context)
return;
context.clearRect(0, 0, size, size); context.clearRect(0, 0, size, size);
_this.renderLayerCircle(context); _this.renderLayerCircle(context);
var formatValue = format(currentValue); var formatValue = format(currentValue);

View File

@ -17,3 +17,5 @@ export declare function toPromise(promiseLike: Promise<unknown> | unknown): Prom
export declare function addNumber(num1: any, num2: any): number; export declare function addNumber(num1: any, num2: any): number;
export declare const clamp: (num: any, min: any, max: 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 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;

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
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; 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 validator_1 = require("./validator");
var version_1 = require("./version"); var version_1 = require("./version");
var validator_2 = require("./validator"); var validator_2 = require("./validator");
@ -104,3 +104,6 @@ function getCurrentPage() {
return pages[pages.length - 1]; return pages[pages.length - 1];
} }
exports.getCurrentPage = getCurrentPage; exports.getCurrentPage = getCurrentPage;
exports.isPC = ['mac', 'windows'].includes((0, version_1.getSystemInfoSync)().platform);
// 是否企业微信
exports.isWxWork = (0, version_1.getSystemInfoSync)().environment === 'wxwork';

View File

@ -1,5 +1,10 @@
/// <reference types="miniprogram-api-typings" /> /// <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 canIUseModel(): boolean;
export declare function canIUseFormFieldButton(): boolean; export declare function canIUseFormFieldButton(): boolean;
export declare function canIUseAnimate(): boolean; export declare function canIUseAnimate(): boolean;
@ -7,3 +12,4 @@ export declare function canIUseGroupSetData(): boolean;
export declare function canIUseNextTick(): boolean; export declare function canIUseNextTick(): boolean;
export declare function canIUseCanvas2d(): boolean; export declare function canIUseCanvas2d(): boolean;
export declare function canIUseGetUserProfile(): boolean; export declare function canIUseGetUserProfile(): boolean;
export {};

View File

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

View File

@ -6,6 +6,7 @@ var color_1 = require("../common/color");
var utils_1 = require("../common/utils"); var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
mixins: [button_1.button], mixins: [button_1.button],
classes: ['cancle-button-class', 'confirm-button-class'],
props: { props: {
show: { show: {
type: Boolean, type: Boolean,
@ -19,14 +20,17 @@ var utils_1 = require("../common/utils");
type: String, type: String,
value: 'default', value: 'default',
}, },
useSlot: Boolean, confirmButtonId: String,
className: String, className: String,
customStyle: String, customStyle: String,
asyncClose: Boolean, asyncClose: Boolean,
messageAlign: String, messageAlign: String,
beforeClose: null, beforeClose: null,
overlayStyle: String, overlayStyle: String,
useSlot: Boolean,
useTitleSlot: Boolean, useTitleSlot: Boolean,
useConfirmButtonSlot: Boolean,
useCancelButtonSlot: Boolean,
showCancelButton: Boolean, showCancelButton: Boolean,
closeOnClickOverlay: Boolean, closeOnClickOverlay: Boolean,
confirmButtonOpenType: String, confirmButtonOpenType: String,
@ -63,6 +67,10 @@ var utils_1 = require("../common/utils");
type: String, type: String,
value: 'scale', value: 'scale',
}, },
rootPortal: {
type: Boolean,
value: false,
},
}, },
data: { data: {
loading: { loading: {

View File

@ -9,6 +9,7 @@
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}" custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}" overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay" bind:close="onClickOverlay"
> >
<view <view
@ -33,7 +34,7 @@
size="large" size="large"
loading="{{ loading.cancel }}" loading="{{ loading.cancel }}"
class="van-dialog__button van-hairline--right" class="van-dialog__button van-hairline--right"
custom-class="van-dialog__cancel" custom-class="van-dialog__cancel cancle-button-class"
custom-style="color: {{ cancelButtonColor }}" custom-style="color: {{ cancelButtonColor }}"
bind:click="onCancel" bind:click="onCancel"
> >
@ -44,9 +45,9 @@
size="large" size="large"
class="van-dialog__button" class="van-dialog__button"
loading="{{ loading.confirm }}" loading="{{ loading.confirm }}"
custom-class="van-dialog__confirm" custom-class="van-dialog__confirm confirm-button-class"
custom-style="color: {{ confirmButtonColor }}" custom-style="color: {{ confirmButtonColor }}"
button-id="{{ confirmButtonId }}"
open-type="{{ confirmButtonOpenType }}" open-type="{{ confirmButtonOpenType }}"
lang="{{ lang }}" lang="{{ lang }}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
@ -56,7 +57,8 @@
send-message-img="{{ sendMessageImg }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
bind:click="onConfirm" bind:click="onConfirm"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
@ -70,44 +72,54 @@
</van-goods-action> </van-goods-action>
<view wx:elif="{{ showCancelButton || showConfirmButton }}" class="van-hairline--top van-dialog__footer"> <view wx:elif="{{ showCancelButton || showConfirmButton }}" class="van-hairline--top van-dialog__footer">
<van-button <block wx:if="{{ showCancelButton }}">
wx:if="{{ showCancelButton }}" <slot wx:if="{{ useCancelButtonSlot }}" name="cancel-button" />
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 }}"
open-type="{{ confirmButtonOpenType }}" <van-button
lang="{{ lang }}" wx:else
business-id="{{ businessId }}" size="large"
session-from="{{ sessionFrom }}" loading="{{ loading.cancel }}"
send-message-title="{{ sendMessageTitle }}" class="van-dialog__button van-hairline--right"
send-message-path="{{ sendMessagePath }}" custom-class="van-dialog__cancel cancle-button-class"
send-message-img="{{ sendMessageImg }}" custom-style="color: {{ cancelButtonColor }}"
show-message-card="{{ showMessageCard }}" bind:click="onCancel"
app-parameter="{{ appParameter }}" >
{{ cancelButtonText }}
</van-button>
</block>
bind:click="onConfirm" <block wx:if="{{ showConfirmButton }}">
bindgetuserinfo="onGetUserInfo" <slot wx:if="{{ useConfirmButtonSlot }}" name="confirm-button" />
bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber" <van-button
binderror="onError" wx:else
bindlaunchapp="onLaunchApp" size="large"
bindopensetting="onOpenSetting" class="van-dialog__button"
> loading="{{ loading.confirm }}"
{{ confirmButtonText }} custom-class="van-dialog__confirm confirm-button-class"
</van-button> 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> </view>
</van-popup> </van-popup>

View File

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

View File

@ -13,12 +13,12 @@
title-style="margin-right: 12px;" title-style="margin-right: 12px;"
custom-style="{{ customStyle }}" custom-style="{{ customStyle }}"
arrow-direction="{{ arrowDirection }}" arrow-direction="{{ arrowDirection }}"
custom-class="van-field" custom-class="custom-class van-field"
> >
<slot name="left-icon" slot="icon" /> <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 }} {{ label }}
</view> </label>
<slot wx:else name="label" slot="title" /> <slot wx:else name="label" slot="title" />
<view class="{{ utils.bem('field__body', [type]) }}"> <view class="{{ utils.bem('field__body', [type]) }}">
<view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput"> <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
@ -47,10 +47,10 @@
<slot name="button" /> <slot name="button" />
</view> </view>
</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 class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
</view> </label>
<view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}"> <label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
{{ errorMessage }} {{ errorMessage }}
</view> </label>
</van-cell> </van-cell>

View File

@ -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)}

View File

@ -1,4 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<input <input
id="{{ name }}"
class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class" class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
type="{{ type }}" type="{{ type }}"
focus="{{ focus }}" focus="{{ focus }}"
@ -25,4 +27,5 @@
bindfocus="onFocus" bindfocus="onFocus"
bindconfirm="onConfirm" bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange" bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/> />

View File

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

View File

@ -1,4 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<textarea <textarea
id="{{ name }}"
class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class" class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
fixed="{{ fixed }}" fixed="{{ fixed }}"
focus="{{ focus }}" focus="{{ focus }}"

View File

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

View File

@ -1,6 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<van-button <van-button
id="{{ id }}" id="{{ id }}"
button-id="{{ buttonId }}"
lang="{{ lang }}" lang="{{ lang }}"
type="{{ type }}" type="{{ type }}"
size="{{ size }}" size="{{ size }}"
@ -10,7 +11,8 @@
disabled="{{ disabled }}" disabled="{{ disabled }}"
open-type="{{ openType }}" open-type="{{ openType }}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}" 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 }}" business-id="{{ businessId }}"
session-from="{{ sessionFrom }}" session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
@ -23,6 +25,8 @@
bindcontact="onContact" bindcontact="onContact"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
> >

View File

@ -34,6 +34,8 @@
custom-class="icon-class" custom-class="icon-class"
info-class="info-class" info-class="info-class"
/> />
<slot wx:else name="icon" /> <view wx:else>
<slot name="icon" />
</view>
<text class="text-class">{{ text }}</text> <text class="text-class">{{ text }}</text>
</van-button> </van-button>

File diff suppressed because one or more lines are too long

View File

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

View File

@ -6,6 +6,7 @@ exports.button = Behavior({
externalClasses: ['hover-class'], externalClasses: ['hover-class'],
properties: { properties: {
id: String, id: String,
buttonId: String,
lang: String, lang: String,
businessId: Number, businessId: Number,
sessionFrom: String, sessionFrom: String,
@ -31,6 +32,9 @@ exports.button = Behavior({
onGetPhoneNumber: function (event) { onGetPhoneNumber: function (event) {
this.triggerEvent('getphonenumber', event.detail); this.triggerEvent('getphonenumber', event.detail);
}, },
onGetRealTimePhoneNumber: function (event) {
this.triggerEvent('getrealtimephonenumber', event.detail);
},
onError: function (event) { onError: function (event) {
this.triggerEvent('error', event.detail); this.triggerEvent('error', event.detail);
}, },
@ -40,6 +44,9 @@ exports.button = Behavior({
onOpenSetting: function (event) { onOpenSetting: function (event) {
this.triggerEvent('opensetting', event.detail); this.triggerEvent('opensetting', event.detail);
}, },
onAgreePrivacyAuthorization: function (event) {
this.triggerEvent('agreeprivacyauthorization', event.detail);
},
onChooseAvatar: function (event) { onChooseAvatar: function (event) {
this.triggerEvent('chooseavatar', event.detail); this.triggerEvent('chooseavatar', event.detail);
}, },

View File

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

View File

@ -108,7 +108,7 @@ var utils_1 = require("../common/utils");
}); });
this.timer = setTimeout(function () { this.timer = setTimeout(function () {
_this.scroll(); _this.scroll();
}, this.duration); }, this.duration + this.data.delay);
}, },
onClickIcon: function (event) { onClickIcon: function (event) {
if (this.data.mode === 'closeable') { if (this.data.mode === 'closeable') {

View File

@ -1,3 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view <view
wx:if="{{ inited }}" wx:if="{{ inited }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}" class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"

View File

@ -55,6 +55,10 @@ var version_1 = require("../common/version");
type: String, type: String,
value: 'clear', value: 'clear',
}, },
cursorSpacing: {
type: Number,
value: 0,
},
}, },
methods: { methods: {
onChange: function (event) { onChange: function (event) {

View File

@ -28,6 +28,7 @@
input-class="input-class" input-class="input-class"
placeholder="{{ placeholder }}" placeholder="{{ placeholder }}"
placeholder-style="{{ placeholderStyle }}" placeholder-style="{{ placeholderStyle }}"
cursor-spacing="{{ cursorSpacing }}"
custom-style="padding: 5px 10px 5px 0; background-color: transparent;" custom-style="padding: 5px 10px 5px 0; background-color: transparent;"
bind:blur="onBlur" bind:blur="onBlur"
bind:focus="onFocus" bind:focus="onFocus"

View File

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

View File

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

View File

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

View File

@ -61,10 +61,8 @@ var ROOT_ELEMENT = '.van-sticky';
} }
this.scrollTop = scrollTop || this.scrollTop; this.scrollTop = scrollTop || this.scrollTop;
if (typeof container === 'function') { if (typeof container === 'function') {
Promise.all([ Promise.all([(0, utils_1.getRect)(this, ROOT_ELEMENT), this.getContainerRect()])
(0, utils_1.getRect)(this, ROOT_ELEMENT), .then(function (_a) {
this.getContainerRect(),
]).then(function (_a) {
var root = _a[0], container = _a[1]; var root = _a[0], container = _a[1];
if (offsetTop + root.height > container.height + container.top) { if (offsetTop + root.height > container.height + container.top) {
_this.setDataAfterDiff({ _this.setDataAfterDiff({
@ -82,11 +80,12 @@ var ROOT_ELEMENT = '.van-sticky';
else { else {
_this.setDataAfterDiff({ fixed: false, transform: 0 }); _this.setDataAfterDiff({ fixed: false, transform: 0 });
} }
}); })
.catch(function () { });
return; return;
} }
(0, utils_1.getRect)(this, ROOT_ELEMENT).then(function (root) { (0, utils_1.getRect)(this, ROOT_ELEMENT).then(function (root) {
if (!(0, validator_1.isDef)(root)) { if (!(0, validator_1.isDef)(root) || (!root.width && !root.height)) {
return; return;
} }
if (offsetTop >= root.top) { if (offsetTop >= root.top) {
@ -118,6 +117,9 @@ var ROOT_ELEMENT = '.van-sticky';
}, },
getContainerRect: function () { getContainerRect: function () {
var nodesRef = this.data.container(); var nodesRef = this.data.container();
if (!nodesRef) {
return Promise.reject(new Error('not found container'));
}
return new Promise(function (resolve) { return nodesRef.boundingClientRect(resolve).exec(); }); return new Promise(function (resolve) { return nodesRef.boundingClientRect(resolve).exec(); });
}, },
}, },

View File

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

View File

@ -28,6 +28,8 @@
title="{{ item.name || ('视频' + index) }}" title="{{ item.name || ('视频' + index) }}"
poster="{{ item.thumb }}" poster="{{ item.thumb }}"
autoplay="{{ item.autoplay }}" autoplay="{{ item.autoplay }}"
object-fit="{{videoFit}}"
referrer-policy="{{videoReferrerPolicy}}"
class="van-uploader__preview-image" class="van-uploader__preview-image"
style="{{ computed.sizeStyle({ previewSize }) }}" style="{{ computed.sizeStyle({ previewSize }) }}"
data-index="{{ index }}" data-index="{{ index }}"

View File

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

View File

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

View File

@ -41,7 +41,7 @@ function isVideoFile(item) {
} }
exports.isVideoFile = isVideoFile; exports.isVideoFile = isVideoFile;
function formatImage(res) { function formatImage(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { type: 'image', url: item.tempFilePath, thumb: item.tempFilePath })); }); return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { type: 'image', url: item.tempFilePath || item.path, thumb: item.tempFilePath || item.path })); });
} }
function formatVideo(res) { function formatVideo(res) {
return [ return [
@ -49,7 +49,7 @@ function formatVideo(res) {
]; ];
} }
function formatMedia(res) { function formatMedia(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: res.type, url: item.tempFilePath, thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath })); }); return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: item.fileType, url: item.tempFilePath, thumb: item.fileType === 'video' ? item.thumbTempFilePath : item.tempFilePath })); });
} }
function formatFile(res) { function formatFile(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); }); return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); });
@ -59,16 +59,27 @@ function chooseFile(_a) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
switch (accept) { switch (accept) {
case 'image': case 'image':
wx.chooseMedia({ if (utils_1.isPC || utils_1.isWxWork) {
count: multiple ? Math.min(maxCount, 9) : 1, wx.chooseImage({
mediaType: ['image'], count: multiple ? Math.min(maxCount, 9) : 1,
sourceType: capture, sourceType: capture,
maxDuration: maxDuration, sizeType: sizeType,
sizeType: sizeType, success: function (res) { return resolve(formatImage(res)); },
camera: camera, fail: reject,
success: function (res) { return resolve(formatImage(res)); }, });
fail: reject, }
}); else {
wx.chooseMedia({
count: multiple ? Math.min(maxCount, 9) : 1,
mediaType: ['image'],
sourceType: capture,
maxDuration: maxDuration,
sizeType: sizeType,
camera: camera,
success: function (res) { return resolve(formatImage(res)); },
fail: reject,
});
}
break; break;
case 'media': case 'media':
wx.chooseMedia({ wx.chooseMedia({

View File

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

View File

@ -166,6 +166,7 @@ Page({
| close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` | | close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` |
| close-on-click-overlay | 点击遮罩是否关闭菜单 | _boolean_ | `true` | | close-on-click-overlay | 点击遮罩是否关闭菜单 | _boolean_ | `true` |
| safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | _boolean_ | `true` | | safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | _boolean_ | `true` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Events ### Events
@ -178,6 +179,8 @@ Page({
| bind:getuserinfo | 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与 wx.getUserInfo 返回的一致,<a href="#/action-sheet#actions">openType</a>="getUserInfo"时有效 | - | | bind:getuserinfo | 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与 wx.getUserInfo 返回的一致,<a href="#/action-sheet#actions">openType</a>="getUserInfo"时有效 | - |
| bind:contact | 客服消息回调,<a href="#/action-sheet#actions">openType</a>="contact"时有效 | - | | bind:contact | 客服消息回调,<a href="#/action-sheet#actions">openType</a>="contact"时有效 | - |
| bind:getphonenumber | 获取用户手机号回调,<a href="#/action-sheet#actions">openType</a>="getPhoneNumber"时有效 | - | | bind:getphonenumber | 获取用户手机号回调,<a href="#/action-sheet#actions">openType</a>="getPhoneNumber"时有效 | - |
| bind:getrealtimephonenumber `v1.10.21` | 获取手机号实时验证回调,<a href="#/action-sheet#actions">openType</a>="getRealtimePhoneNumber"时有效 | - |
| bind:agreeprivacyauthorization `v1.10.24` | 同意隐私协议回调,<a href="#/action-sheet#actions">openType</a>="agreePrivacyAuthorization"时有效 | - |
| bind:error | 当使用开放能力时,发生错误的回调,<a href="#/action-sheet#actions">openType</a>="launchApp"时有效 | - | | bind:error | 当使用开放能力时,发生错误的回调,<a href="#/action-sheet#actions">openType</a>="launchApp"时有效 | - |
| bind:launchapp | 打开 APP 成功的回调,<a href="#/action-sheet#actions">openType</a>="launchApp"时有效 | - | | bind:launchapp | 打开 APP 成功的回调,<a href="#/action-sheet#actions">openType</a>="launchApp"时有效 | - |
| bind:opensetting | 在打开授权设置页后回调,<a href="#/action-sheet#actions">openType</a>="openSetting"时有效 | - | | bind:opensetting | 在打开授权设置页后回调,<a href="#/action-sheet#actions">openType</a>="openSetting"时有效 | - |
@ -205,7 +208,7 @@ Page({
### 外部样式类 ### 外部样式类
| 类名 | 说明 | | 类名 | 说明 |
| ------------ | -------------- | | ---------------------- | ------------------- |
| custom-class `v1.10.7` | 根节点样式类 | | custom-class `v1.10.7` | 根节点样式类 |
| list-class `v1.10.7` | `actions`容器样式类 | | list-class `v1.10.7` | `actions`容器样式类 |

View File

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

View File

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

View File

@ -31,10 +31,12 @@ exports[`should render demo and match snapshot 1`] = `
sessionFrom="" sessionFrom=""
showMessageCard="{{false}}" showMessageCard="{{false}}"
style="" style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar" bind:chooseavatar="onChooseAvatar"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
bind:getphonenumber="onGetPhoneNumber" bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo" bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp" bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting" bind:opensetting="onOpenSetting"
@ -96,10 +98,12 @@ exports[`should render demo and match snapshot 1`] = `
sessionFrom="" sessionFrom=""
showMessageCard="{{false}}" showMessageCard="{{false}}"
style="" style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar" bind:chooseavatar="onChooseAvatar"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
bind:getphonenumber="onGetPhoneNumber" bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo" bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp" bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting" bind:opensetting="onOpenSetting"
@ -161,10 +165,12 @@ exports[`should render demo and match snapshot 1`] = `
sessionFrom="" sessionFrom=""
showMessageCard="{{false}}" showMessageCard="{{false}}"
style="" style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar" bind:chooseavatar="onChooseAvatar"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
bind:getphonenumber="onGetPhoneNumber" bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo" bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp" bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting" bind:opensetting="onOpenSetting"
@ -226,10 +232,12 @@ exports[`should render demo and match snapshot 1`] = `
sessionFrom="" sessionFrom=""
showMessageCard="{{false}}" showMessageCard="{{false}}"
style="" style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar" bind:chooseavatar="onChooseAvatar"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
bind:getphonenumber="onGetPhoneNumber" bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo" bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp" bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting" bind:opensetting="onOpenSetting"
@ -291,10 +299,12 @@ exports[`should render demo and match snapshot 1`] = `
sessionFrom="" sessionFrom=""
showMessageCard="{{false}}" showMessageCard="{{false}}"
style="" style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar" bind:chooseavatar="onChooseAvatar"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
bind:getphonenumber="onGetPhoneNumber" bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo" bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp" bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting" bind:opensetting="onOpenSetting"
@ -356,10 +366,12 @@ exports[`should render demo and match snapshot 1`] = `
sessionFrom="" sessionFrom=""
showMessageCard="{{false}}" showMessageCard="{{false}}"
style="" style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar" bind:chooseavatar="onChooseAvatar"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
bind:getphonenumber="onGetPhoneNumber" bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo" bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp" bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting" bind:opensetting="onOpenSetting"

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