Skip to content

Commit

Permalink
Merge branch 'youzan:dev' into fix-cascader-value-change
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxqd authored Apr 15, 2024
2 parents 3dd0fe9 + ab45d80 commit 4992403
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 84 deletions.
3 changes: 3 additions & 0 deletions dist/field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ VantComponent({
onKeyboardHeightChange(event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview(event) {
this.$emit('nicknamereview', event.detail);
},
emitChange(detail) {
const { extraEventParams } = this.data;
this.setData({ value: detail.value });
Expand Down
1 change: 1 addition & 0 deletions dist/field/input.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
1 change: 0 additions & 1 deletion dist/mixins/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
Expand Down
7 changes: 1 addition & 6 deletions dist/stepper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ VantComponent({
if (value === '') {
return;
}
let formatted = this.filter(value);
// limit max decimal length
if (isDef(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
const pair = formatted.split('.');
formatted = `${pair[0]}.${pair[1].slice(0, this.data.decimalLength)}`;
}
let formatted = this.format(value);
this.emitChange(formatted);
},
emitChange(value) {
Expand Down
19 changes: 19 additions & 0 deletions docs/markdown/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
# 更新日志

### [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`
Expand Down
27 changes: 2 additions & 25 deletions docs/markdown/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,13 @@ npm i vant-weapp -S --production

将 app.json 中的 `"style": "v2"` 去除,小程序的[新版基础组件](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#style)强行加上了许多样式,难以覆盖,不关闭将造成部分组件样式混乱。

### 步骤三 修改 project.config.json

开发者工具创建的项目,`miniprogramRoot` 默认为 `miniprogram``package.json` 在其外部,npm 构建无法正常工作。

需要手动在 `project.config.json` 内添加如下配置,使开发者工具可以正确索引到 npm 依赖的位置。

```json
{
...
"setting": {
...
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./miniprogram/"
}
]
}
}
```
注意: 由于目前新版开发者工具创建的小程序目录文件结构问题,npm构建的文件目录为miniprogram_npm,并且开发工具会默认在当前目录下创建miniprogram_npm的文件名,所以新版本的miniprogramNpmDistDir配置为'./'即可

### 步骤四 构建 npm 包
### 步骤三 构建 npm 包

打开微信开发者工具,点击 **工具 -> 构建 npm**,并勾选 **使用 npm 模块** 选项,构建完成后,即可引入组件。

<img style="width: 500px;" src="https://img.yzcdn.cn/public_files/2019/08/15/fa0549210055976cb63798503611ce3d.png" />

### 步骤五 typescript 支持
### 步骤四 typescript 支持

如果你使用 typescript 开发小程序,还需要做如下操作,以获得顺畅的开发体验。

Expand Down
3 changes: 3 additions & 0 deletions lib/field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ var props_1 = require("./props");
onKeyboardHeightChange: function (event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview: function (event) {
this.$emit('nicknamereview', event.detail);
},
emitChange: function (detail) {
var extraEventParams = this.data.extraEventParams;
this.setData({ value: detail.value });
Expand Down
1 change: 1 addition & 0 deletions lib/field/input.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
1 change: 0 additions & 1 deletion lib/mixins/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function transition(showDefaultValue) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
Expand Down
7 changes: 1 addition & 6 deletions lib/stepper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ function equal(value1, value2) {
if (value === '') {
return;
}
var formatted = this.filter(value);
// limit max decimal length
if ((0, validator_1.isDef)(this.data.decimalLength) && formatted.indexOf('.') !== -1) {
var pair = formatted.split('.');
formatted = "".concat(pair[0], ".").concat(pair[1].slice(0, this.data.decimalLength));
}
var formatted = this.format(value);
this.emitChange(formatted);
},
emitChange: function (value) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
"version": "1.11.4",
"version": "1.11.5",
"author": "vant-ui",
"license": "MIT",
"miniprogram": "lib",
Expand Down
4 changes: 4 additions & 0 deletions packages/cascader/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -187,6 +188,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -298,6 +300,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -409,6 +412,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
4 changes: 4 additions & 0 deletions packages/config-provider/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -300,6 +301,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -544,6 +546,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -661,6 +664,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
3 changes: 2 additions & 1 deletion packages/field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Page({
| label | 输入框左侧文本 | _string_ | - |
| size | 单元格大小,可选值为 `large` | _string_ | - |
| value | 当前输入的值 | _string \| number_ | - |
| type | 可设置为任意原生类型, 如 `number` `idcard` `textarea` `digit` | _string_ | `text` |
| type | 可设置为任意原生类型, 如 `number` `idcard` `textarea` `digit` `nickname` | _string_ | `text` |
| fixed | 如果 type 为 `textarea` 且在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | _boolean_ | `false` |
| focus | 获取焦点 | _boolean_ | `false` |
| border | 是否显示内边框 | _boolean_ | `true` |
Expand Down Expand Up @@ -309,6 +309,7 @@ Page({
| bind:click-input | 点击输入区域时触发 | - |
| bind:linechange | 输入框行数变化时调用,只对 textarea 有效 | event.detail = { height: 0, heightRpx: 0, lineCount: 0 } |
| bind:keyboardheightchange | 键盘高度发生变化的时候触发此事件 | event.detail = { height: height, duration: duration } |
| bind:nicknamereview `v1.11.5` | 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效 | event.detail = { pass, timeout } |

### InputDetail

Expand Down
4 changes: 4 additions & 0 deletions packages/field/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ VantComponent({
this.$emit('keyboardheightchange', event.detail);
},

onBindNicknameReview(event) {
this.$emit('nicknamereview', event.detail);
},

emitChange(detail: InputDetails) {
const { extraEventParams } = this.data;

Expand Down
1 change: 1 addition & 0 deletions packages/field/input.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
8 changes: 8 additions & 0 deletions packages/field/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -163,6 +164,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -250,6 +252,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -353,6 +356,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -446,6 +450,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -522,6 +527,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -623,6 +629,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -814,6 +821,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
1 change: 0 additions & 1 deletion packages/mixins/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function transition(showDefaultValue: boolean) {
duration: {
type: null,
value: 300,
observer: 'observeDuration',
},
name: {
type: String,
Expand Down
6 changes: 6 additions & 0 deletions packages/search/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -203,6 +204,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -322,6 +324,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -429,6 +432,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -536,6 +540,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -650,6 +655,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
8 changes: 1 addition & 7 deletions packages/stepper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,7 @@ VantComponent({
return;
}

let formatted = this.filter(value);

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

this.emitChange(formatted);
},
Expand Down
Loading

0 comments on commit 4992403

Please sign in to comment.