From 4dc423993d635e2ff6fdd094fa0c26d9ed6a8794 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 20 Apr 2020 19:33:28 +0800 Subject: [PATCH 1/5] fix: sort vnode not work (#6100) --- src/utils/vnodes.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/vnodes.ts b/src/utils/vnodes.ts index 27ca5f80a..516f40717 100644 --- a/src/utils/vnodes.ts +++ b/src/utils/vnodes.ts @@ -18,17 +18,16 @@ function flattenVNodes(vnodes: VNode[]) { } type VueInstance = { - _vnode: VNode; $vnode: VNode; }; // sort children instances by vnodes order export function sortChildren(children: VueInstance[], parent: VueInstance) { - // null on SSR - if (!parent._vnode) { + const { componentOptions } = parent.$vnode; + if (!componentOptions || !componentOptions.children) { return; } - const vnodes = flattenVNodes(parent._vnode.children!); + const vnodes = flattenVNodes(componentOptions.children); children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode)); } From 58aa20cd4e5c2dfef065ea572d3479097254ccc8 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 20 Apr 2020 19:46:26 +0800 Subject: [PATCH 2/5] fix(Tab): fail to init in some cases (#6101) --- src/tab/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tab/index.js b/src/tab/index.js index 807fcced3..75489232e 100644 --- a/src/tab/index.js +++ b/src/tab/index.js @@ -30,16 +30,16 @@ export default createComponent({ }, isActive() { - return this.computedName === this.parent.currentName; + const active = this.computedName === this.parent.currentName; + + if (active) { + this.inited = true; + } + return active; }, }, watch: { - // eslint-disable-next-line object-shorthand - 'parent.currentIndex'() { - this.inited = this.inited || this.isActive; - }, - title() { this.parent.setLine(); }, From 166dd00dfb91b63d170b764c307d1ff68af32dee Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 20 Apr 2020 19:54:12 +0800 Subject: [PATCH 3/5] test(Tab): add dynamic insert case (#6102) --- .../test/__snapshots__/insert.spec.js.snap | 23 ++++++++++++++++ src/tab/test/insert.spec.js | 27 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/tab/test/__snapshots__/insert.spec.js.snap create mode 100644 src/tab/test/insert.spec.js diff --git a/src/tab/test/__snapshots__/insert.spec.js.snap b/src/tab/test/__snapshots__/insert.spec.js.snap new file mode 100644 index 000000000..8718f18e6 --- /dev/null +++ b/src/tab/test/__snapshots__/insert.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`insert tab dynamically 1`] = ` +
+
+
+ + + +
+
+
+
+ +
+
2
+
+ +
+
+`; diff --git a/src/tab/test/insert.spec.js b/src/tab/test/insert.spec.js new file mode 100644 index 000000000..ba7f9f478 --- /dev/null +++ b/src/tab/test/insert.spec.js @@ -0,0 +1,27 @@ +import { mount, later } from '../../../test'; + +// this case will throw wierd error in index.spec.js +// so separate it +test('insert tab dynamically', async () => { + const wrapper = mount({ + template: ` + + 1 +
+ 2 +
+ 3 +
+ `, + data() { + return { + insert: false, + active: 1, + }; + }, + }); + + await later(); + wrapper.setData({ insert: true }); + expect(wrapper).toMatchSnapshot(); +}); From 15c975fd2b688bdfd539f41c1476d7fc61c99404 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 20 Apr 2020 20:01:17 +0800 Subject: [PATCH 4/5] chore: release 2.6.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 72f5ff1f2..23dff83b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "2.6.2", + "version": "2.6.3", "description": "Mobile UI Components built on Vue", "main": "lib/index.js", "module": "es/index.js", From 6cba3f9b5ee815b4d36f99b39ae141e9aad96ec9 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 20 Apr 2020 20:03:49 +0800 Subject: [PATCH 5/5] docs(changelog): 2.6.3 --- docs/markdown/changelog.en-US.md | 9 +++++++++ docs/markdown/changelog.zh-CN.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/markdown/changelog.en-US.md b/docs/markdown/changelog.en-US.md index b51645c41..3f4764169 100644 --- a/docs/markdown/changelog.en-US.md +++ b/docs/markdown/changelog.en-US.md @@ -10,6 +10,15 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/). - Minor version:released every one to two months, including backwards compatible features. - Major version:including breaking changes and new features. +### [v2.6.3](https://github.com/youzan/vant/compare/v2.6.2...v2.6.3) + +`2020-04-20` + +**Bug Fixes** + +- Tab: fail to init in some cases [#6101](https://github.com/youzan/vant/issues/6101) +- sort vnode not work [#6100](https://github.com/youzan/vant/issues/6100) + ### [v2.6.2](https://github.com/youzan/vant/compare/v2.6.1...v2.6.2) `2020-04-18` diff --git a/docs/markdown/changelog.zh-CN.md b/docs/markdown/changelog.zh-CN.md index c94404eb2..fd04aea22 100644 --- a/docs/markdown/changelog.zh-CN.md +++ b/docs/markdown/changelog.zh-CN.md @@ -10,6 +10,15 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。 - 次版本号:每隔一至二个月发布,包含新特性和较大的功能更新,向下兼容。 - 主版本号:发布时间不定,包含不兼容更新,预计下一个主版本会与 Vue 3.0 同期发布。 +### [v2.6.3](https://github.com/youzan/vant/compare/v2.6.2...v2.6.3) + +`2020-04-20` + +**Bug Fixes** + +- Tab: 修复在部分浏览器上可能出现顺序错乱的问题 [#6100](https://github.com/youzan/vant/issues/6100) +- Tab: 修复动态插入标签时可能出现渲染错误的问题 [#6101](https://github.com/youzan/vant/issues/6101) + ### [v2.6.2](https://github.com/youzan/vant/compare/v2.6.1...v2.6.2) `2020-04-18`