Compare commits

..

5 Commits

Author SHA1 Message Date
nemo-shen
e12ad16e37 docs(changelog): v1.6.9 2021-06-06 20:47:11 +08:00
nemo-shen
9b5ab4e29c docs(changelog): v1.6.9 2021-06-06 20:41:38 +08:00
nemo-shen
c43fec08a7 docs(changelog): 1.6.9 2021-06-06 20:28:29 +08:00
nemo-shen
0f1aaa59ff build: release 1.6.9 2021-06-06 20:05:48 +08:00
nemo-shen
b649e2226c build: compile 1.6.9 2021-06-06 20:05:42 +08:00
8 changed files with 75 additions and 40 deletions

View File

@ -93,13 +93,11 @@ VantComponent({
const { data } = this;
const val = this.correctValue(data.value);
const isEqual = val === data.innerValue;
if (!isEqual) {
this.updateColumnValue(val).then(() => {
this.updateColumnValue(val).then(() => {
if (!isEqual) {
this.$emit('input', val);
});
} else {
this.updateColumns();
}
}
});
},
getPicker() {
if (this.picker == null) {

35
dist/tabs/index.js vendored
View File

@ -43,6 +43,9 @@ VantComponent({
type: null,
value: 0,
observer(name) {
if (!this.skipInit) {
this.skipInit = true;
}
if (name !== this.getCurrentName()) {
this.setCurrentIndexByName(name);
}
@ -89,6 +92,7 @@ VantComponent({
currentIndex: 0,
container: null,
skipTransition: true,
scrollWithAnimation: false,
lineOffsetLeft: 0,
},
mounted() {
@ -96,8 +100,10 @@ VantComponent({
this.setData({
container: () => this.createSelectorQuery().select('.van-tabs'),
});
this.resize(true);
this.scrollIntoView();
if (!this.skipInit) {
this.resize();
this.scrollIntoView();
}
});
},
methods: {
@ -166,9 +172,11 @@ VantComponent({
}
const shouldEmitChange = data.currentIndex !== null;
this.setData({ currentIndex });
nextTick(() => {
requestAnimationFrame(() => {
this.resize();
this.scrollIntoView();
});
nextTick(() => {
this.trigger('input');
if (shouldEmitChange) {
this.trigger('change');
@ -181,11 +189,11 @@ VantComponent({
return activeTab.getComputedName();
}
},
resize(skipTransition = false) {
resize() {
if (this.data.type !== 'line') {
return;
}
const { currentIndex, ellipsis } = this.data;
const { currentIndex, ellipsis, skipTransition } = this.data;
Promise.all([
getAllRect(this, '.van-tab'),
getRect(this, '.van-tabs__line'),
@ -199,15 +207,17 @@ VantComponent({
.reduce((prev, curr) => prev + curr.width, 0);
lineOffsetLeft +=
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
this.setData({
lineOffsetLeft,
skipTransition,
});
this.setData({ lineOffsetLeft });
if (skipTransition) {
nextTick(() => {
this.setData({ skipTransition: false });
});
}
});
},
// scroll active tab into view
scrollIntoView() {
const { currentIndex, scrollable } = this.data;
const { currentIndex, scrollable, scrollWithAnimation } = this.data;
if (!scrollable) {
return;
}
@ -222,6 +232,11 @@ VantComponent({
this.setData({
scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2,
});
if (!scrollWithAnimation) {
nextTick(() => {
this.setData({ scrollWithAnimation: true });
});
}
});
},
onTouchScroll(event) {

View File

@ -14,7 +14,7 @@
<scroll-view
scroll-x="{{ scrollable }}"
scroll-with-animation
scroll-with-animation="{{ scrollWithAnimation }}"
scroll-left="{{ scrollLeft }}"
class="{{ utils.bem('tabs__scroll', [type]) }}"
style="{{ color ? 'border-color: ' + color : '' }}"

View File

@ -1,8 +1,18 @@
# 更新日志
### [1.6.9-beta.2](https://github.com/youzan/vant-weapp/compare/v1.6.8...v1.6.9-beta.2) (2021-05-22)
### [1.6.9](https://github.com/youzan/vant-weapp/tree/v1.6.9)
`2021-05-23`
`2021-06-06`
**Bug Fixes**
- DatetimePicker: 修复 动态设置 min-hour min-date 显示不正确 [#4245](https://github.com/youzan/vant-weapp/issues/4245)
- Tabs: 修复 tab数量较多时滚动距离不正确 [#4202](https://github.com/youzan/vant-weapp/issues/4202)
- Uploader: 修复 demo 中 beforeRead 报错 [#4235](https://github.com/youzan/vant-weapp/issues/4235)
### [1.6.9-beta.2](https://github.com/youzan/vant-weapp/tree/v1.6.9-beta.2)
`2021-05-22`
**Bug Fixes**

View File

@ -120,13 +120,11 @@ component_1.VantComponent({
var data = this.data;
var val = this.correctValue(data.value);
var isEqual = val === data.innerValue;
if (!isEqual) {
this.updateColumnValue(val).then(function () {
this.updateColumnValue(val).then(function () {
if (!isEqual) {
_this.$emit('input', val);
});
} else {
this.updateColumns();
}
}
});
},
getPicker: function () {
if (this.picker == null) {

View File

@ -40,6 +40,9 @@ component_1.VantComponent({
type: null,
value: 0,
observer: function (name) {
if (!this.skipInit) {
this.skipInit = true;
}
if (name !== this.getCurrentName()) {
this.setCurrentIndexByName(name);
}
@ -86,6 +89,7 @@ component_1.VantComponent({
currentIndex: 0,
container: null,
skipTransition: true,
scrollWithAnimation: false,
lineOffsetLeft: 0,
},
mounted: function () {
@ -96,8 +100,10 @@ component_1.VantComponent({
return _this.createSelectorQuery().select('.van-tabs');
},
});
_this.resize(true);
_this.scrollIntoView();
if (!_this.skipInit) {
_this.resize();
_this.scrollIntoView();
}
});
},
methods: {
@ -177,9 +183,11 @@ component_1.VantComponent({
}
var shouldEmitChange = data.currentIndex !== null;
this.setData({ currentIndex: currentIndex });
utils_1.nextTick(function () {
utils_1.requestAnimationFrame(function () {
_this.resize();
_this.scrollIntoView();
});
utils_1.nextTick(function () {
_this.trigger('input');
if (shouldEmitChange) {
_this.trigger('change');
@ -192,17 +200,15 @@ component_1.VantComponent({
return activeTab.getComputedName();
}
},
resize: function (skipTransition) {
resize: function () {
var _this = this;
if (skipTransition === void 0) {
skipTransition = false;
}
if (this.data.type !== 'line') {
return;
}
var _a = this.data,
currentIndex = _a.currentIndex,
ellipsis = _a.ellipsis;
ellipsis = _a.ellipsis,
skipTransition = _a.skipTransition;
Promise.all([
utils_1.getAllRect(this, '.van-tab'),
utils_1.getRect(this, '.van-tabs__line'),
@ -221,10 +227,12 @@ component_1.VantComponent({
}, 0);
lineOffsetLeft +=
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
_this.setData({
lineOffsetLeft: lineOffsetLeft,
skipTransition: skipTransition,
});
_this.setData({ lineOffsetLeft: lineOffsetLeft });
if (skipTransition) {
utils_1.nextTick(function () {
_this.setData({ skipTransition: false });
});
}
});
},
// scroll active tab into view
@ -232,7 +240,8 @@ component_1.VantComponent({
var _this = this;
var _a = this.data,
currentIndex = _a.currentIndex,
scrollable = _a.scrollable;
scrollable = _a.scrollable,
scrollWithAnimation = _a.scrollWithAnimation;
if (!scrollable) {
return;
}
@ -251,6 +260,11 @@ component_1.VantComponent({
_this.setData({
scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2,
});
if (!scrollWithAnimation) {
utils_1.nextTick(function () {
_this.setData({ scrollWithAnimation: true });
});
}
});
},
onTouchScroll: function (event) {

View File

@ -14,7 +14,7 @@
<scroll-view
scroll-x="{{ scrollable }}"
scroll-with-animation
scroll-with-animation="{{ scrollWithAnimation }}"
scroll-left="{{ scrollLeft }}"
class="{{ utils.bem('tabs__scroll', [type]) }}"
style="{{ color ? 'border-color: ' + color : '' }}"

View File

@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
"version": "1.6.9-beta.2",
"version": "1.6.9",
"author": "youzan",
"license": "MIT",
"miniprogram": "lib",