diff --git a/dist/calendar/index.wxs b/dist/calendar/index.wxs
index 23df241f..2c04be10 100644
--- a/dist/calendar/index.wxs
+++ b/dist/calendar/index.wxs
@@ -16,6 +16,10 @@ function getMonths(minDate, maxDate) {
}
function getButtonDisabled(type, currentDate) {
+ if (currentDate == null) {
+ return true;
+ }
+
if (type === 'range') {
return !currentDate[0] || !currentDate[1];
}
diff --git a/dist/circle/index.js b/dist/circle/index.js
index ccd5dc7b..75cd1b3f 100644
--- a/dist/circle/index.js
+++ b/dist/circle/index.js
@@ -37,6 +37,10 @@ VantComponent({
value: BLUE,
observer: 'setHoverColor'
},
+ type: {
+ type: String,
+ value: ''
+ },
strokeWidth: {
type: Number,
value: 4
@@ -57,8 +61,8 @@ VantComponent({
return this.ctx;
},
setHoverColor() {
- const context = this.getContext();
- const { color, size } = this.data;
+ const { color, size, type } = this.data;
+ const context = type ? this.getContext(type) : this.getContext();
let hoverColor = color;
if (isObj(color)) {
const LinearColor = context.createLinearGradient(size, 0, 0, 0);
@@ -98,8 +102,8 @@ VantComponent({
this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle);
},
drawCircle(currentValue) {
- const context = this.getContext();
- const { size } = this.data;
+ const { size, type } = this.data;
+ const context = type ? this.getContext(type) : this.getContext();
context.clearRect(0, 0, size, size);
this.renderLayerCircle(context);
const formatValue = format(currentValue);
diff --git a/dist/field/index.js b/dist/field/index.js
index e97b9c36..4abc4f88 100644
--- a/dist/field/index.js
+++ b/dist/field/index.js
@@ -1,109 +1,89 @@
import { VantComponent } from '../common/component';
+import { commonProps, inputProps, textareaProps } from './props';
VantComponent({
field: true,
classes: ['input-class', 'right-icon-class'],
- props: {
- size: String,
- icon: String,
- label: String,
- error: Boolean,
- fixed: Boolean,
- focus: Boolean,
- center: Boolean,
- isLink: Boolean,
- leftIcon: String,
- rightIcon: String,
- disabled: Boolean,
- autosize: [Boolean, Object],
- readonly: Boolean,
- required: Boolean,
- password: Boolean,
- iconClass: String,
- clearable: Boolean,
- clickable: Boolean,
- inputAlign: String,
- placeholder: String,
- customStyle: String,
- confirmType: String,
- confirmHold: Boolean,
- holdKeyboard: Boolean,
- errorMessage: String,
- arrowDirection: String,
- showWordLimit: Boolean,
- placeholderStyle: String,
- errorMessageAlign: String,
- selectionEnd: {
- type: Number,
- value: -1
- },
- selectionStart: {
- type: Number,
- value: -1
- },
- showConfirmBar: {
+ props: Object.assign(Object.assign(Object.assign(Object.assign({}, commonProps), inputProps), textareaProps), { size: String, icon: String, label: String, error: Boolean, center: Boolean, isLink: Boolean, leftIcon: String, rightIcon: String, autosize: [Boolean, Object], readonly: {
+ type: Boolean,
+ observer: 'setShowClear'
+ }, required: Boolean, iconClass: String, clearable: {
+ type: Boolean,
+ observer: 'setShowClear'
+ }, clickable: Boolean, inputAlign: String, customStyle: String, errorMessage: String, arrowDirection: String, showWordLimit: Boolean, errorMessageAlign: String, border: {
type: Boolean,
value: true
- },
- adjustPosition: {
- type: Boolean,
- value: true
- },
- cursorSpacing: {
- type: Number,
- value: 50
- },
- maxlength: {
- type: Number,
- value: -1
- },
- type: {
- type: String,
- value: 'text'
- },
- border: {
- type: Boolean,
- value: true
- },
- titleWidth: {
+ }, titleWidth: {
type: String,
value: '90px'
- }
- },
+ } }),
data: {
focused: false,
+ innerValue: '',
+ showClear: false
+ },
+ created() {
+ this.value = this.data.value;
+ this.setData({ innerValue: this.value });
},
methods: {
onInput(event) {
const { value = '' } = event.detail || {};
- this.setData({ value });
- wx.nextTick(() => {
- this.emitChange(value);
- });
+ this.value = value;
+ this.setShowClear();
+ this.emitChange();
},
onFocus(event) {
- this.setData({ focused: true });
+ this.focused = true;
+ this.setShowClear();
this.$emit('focus', event.detail);
},
onBlur(event) {
- this.setData({ focused: false });
+ this.focused = false;
+ this.setShowClear();
this.$emit('blur', event.detail);
},
onClickIcon() {
this.$emit('click-icon');
},
onClear() {
- this.setData({ value: '' });
+ this.setData({ innerValue: '' });
+ this.value = '';
+ this.setShowClear();
wx.nextTick(() => {
- this.emitChange('');
+ this.emitChange();
this.$emit('clear', '');
});
},
- onConfirm() {
- this.$emit('confirm', this.data.value);
+ onConfirm(event) {
+ const { value = '' } = event.detail || {};
+ this.value = value;
+ this.setShowClear();
+ this.$emit('confirm', value);
},
- emitChange(value) {
- this.$emit('input', value);
- this.$emit('change', value);
+ setValue(value) {
+ this.value = value;
+ this.setShowClear();
+ if (value === '') {
+ this.setData({ innerValue: '' });
+ }
+ this.emitChange();
+ },
+ onLineChange(event) {
+ this.$emit('linechange', event.detail);
+ },
+ onKeyboardHeightChange(event) {
+ this.$emit('keyboardheightchange', event.detail);
+ },
+ emitChange() {
+ this.$emit('input', this.value);
+ this.$emit('change', this.value);
+ },
+ setShowClear() {
+ const { clearable, readonly } = this.data;
+ const { focused, value } = this;
+ this.setData({
+ showClear: clearable && focused && !!value && !readonly
+ });
},
noop() { }
}
diff --git a/dist/field/index.wxml b/dist/field/index.wxml
index e3633db3..aea2e59d 100644
--- a/dist/field/index.wxml
+++ b/dist/field/index.wxml
@@ -23,7 +23,9 @@
class="input-class {{ utils.bem('field__input', [inputAlign, type, { disabled, error }]) }}"
fixed="{{ fixed }}"
focus="{{ focus }}"
- value="{{ value }}"
+ cursor="{{ cursor }}"
+ value="{{ innerValue }}"
+ auto-focus="{{ autoFocus }}"
disabled="{{ disabled || readonly }}"
maxlength="{{ maxlength }}"
placeholder="{{ placeholder }}"
@@ -37,10 +39,13 @@
hold-keyboard="{{ holdKeyboard }}"
selection-end="{{ selectionEnd }}"
selection-start="{{ selectionStart }}"
+ disable-default-padding="{{ disableDefaultPadding }}"
bindinput="onInput"
- bind:blur="onBlur"
- bind:focus="onFocus"
- bind:confirm="onConfirm"
+ bindblur="onBlur"
+ bindfocus="onFocus"
+ bindconfirm="onConfirm"
+ bindlinechange="onLineChange"
+ bindkeyboardheightchange="onKeyboardHeightChange"
>
+declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
+declare type Scroller = (event: IPageScrollOption) => void;
+export declare const pageScrollMixin: (scroller: Scroller) => string;
+export {};
diff --git a/dist/mixins/page-scroll.js b/dist/mixins/page-scroll.js
new file mode 100644
index 00000000..cbf85e2a
--- /dev/null
+++ b/dist/mixins/page-scroll.js
@@ -0,0 +1,28 @@
+function getCurrentPage() {
+ const pages = getCurrentPages();
+ return pages[pages.length - 1] || {};
+}
+function onPageScroll(event) {
+ const { vanPageScroller = [] } = getCurrentPage();
+ vanPageScroller.forEach((scroller) => {
+ if (typeof scroller === 'function') {
+ scroller(event);
+ }
+ });
+}
+export const pageScrollMixin = (scroller) => Behavior({
+ attached() {
+ const page = getCurrentPage();
+ if (Array.isArray(page.vanPageScroller)) {
+ page.vanPageScroller.push(scroller.bind(this));
+ }
+ else {
+ page.vanPageScroller = [page.onPageScroll, scroller.bind(this)];
+ }
+ page.onPageScroll = onPageScroll;
+ },
+ detached() {
+ const page = getCurrentPage();
+ page.vanPageScroller = (page.vanPageScroller || []).filter(item => item !== scroller);
+ }
+});
diff --git a/dist/nav-bar/index.js b/dist/nav-bar/index.js
index 3acf41a8..049caf81 100644
--- a/dist/nav-bar/index.js
+++ b/dist/nav-bar/index.js
@@ -3,7 +3,14 @@ VantComponent({
classes: ['title-class'],
props: {
title: String,
- fixed: Boolean,
+ fixed: {
+ type: Boolean,
+ observer: 'setHeight'
+ },
+ placeholder: {
+ type: Boolean,
+ observer: 'setHeight'
+ },
leftText: String,
rightText: String,
leftArrow: Boolean,
@@ -18,14 +25,21 @@ VantComponent({
safeAreaInsetTop: {
type: Boolean,
value: true
- },
+ }
},
data: {
- statusBarHeight: 0
+ statusBarHeight: 0,
+ height: 44
},
created() {
const { statusBarHeight } = wx.getSystemInfoSync();
- this.setData({ statusBarHeight });
+ this.setData({
+ statusBarHeight,
+ height: 44 + statusBarHeight
+ });
+ },
+ mounted() {
+ this.setHeight();
},
methods: {
onClickLeft() {
@@ -33,6 +47,16 @@ VantComponent({
},
onClickRight() {
this.$emit('click-right');
+ },
+ setHeight() {
+ if (!this.data.fixed || !this.data.placeholder) {
+ return;
+ }
+ wx.nextTick(() => {
+ this.getRect('.van-nav-bar').then((res) => {
+ this.setData({ height: res.height });
+ });
+ });
}
}
});
diff --git a/dist/nav-bar/index.wxml b/dist/nav-bar/index.wxml
index 9ed4446f..9bc58bcb 100644
--- a/dist/nav-bar/index.wxml
+++ b/dist/nav-bar/index.wxml
@@ -1,5 +1,7 @@
+
+
+
diff --git a/dist/sticky/index.js b/dist/sticky/index.js
index f19818e7..4595c876 100644
--- a/dist/sticky/index.js
+++ b/dist/sticky/index.js
@@ -1,4 +1,5 @@
import { VantComponent } from '../common/component';
+import { pageScrollMixin } from '../mixins/page-scroll';
const ROOT_ELEMENT = '.van-sticky';
VantComponent({
props: {
@@ -9,124 +10,90 @@ VantComponent({
offsetTop: {
type: Number,
value: 0,
- observer: 'observeContent'
+ observer: 'onScroll'
},
disabled: {
type: Boolean,
- observer(value) {
- if (!this.mounted) {
- return;
- }
- value ? this.disconnectObserver() : this.initObserver();
- }
+ observer: 'onScroll'
},
container: {
type: null,
- observer(target) {
- if (typeof target !== 'function' || !this.data.height) {
- return;
- }
- this.observeContainer();
- this.updateFixed();
- }
+ observer: 'onScroll'
}
},
+ mixins: [
+ pageScrollMixin(function (event) {
+ this.onScroll(event);
+ })
+ ],
data: {
height: 0,
- fixed: false
+ fixed: false,
+ transform: 0
+ },
+ mounted() {
+ this.onScroll();
},
methods: {
+ onScroll({ scrollTop } = {}) {
+ const { container, offsetTop, disabled } = this.data;
+ if (disabled) {
+ this.setDataAfterDiff({
+ fixed: false,
+ transform: 0
+ });
+ return;
+ }
+ this.scrollTop = scrollTop || this.scrollTop;
+ if (typeof container === 'function') {
+ Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(([root, container]) => {
+ if (offsetTop + root.height > container.height + container.top) {
+ this.setDataAfterDiff({
+ fixed: false,
+ transform: container.height - root.height
+ });
+ }
+ else if (offsetTop >= root.top) {
+ this.setDataAfterDiff({
+ fixed: true,
+ height: root.height,
+ transform: 0
+ });
+ }
+ else {
+ this.setDataAfterDiff({ fixed: false, transform: 0 });
+ }
+ });
+ return;
+ }
+ this.getRect(ROOT_ELEMENT).then((root) => {
+ if (offsetTop >= root.top) {
+ this.setDataAfterDiff({ fixed: true, height: root.height });
+ this.transform = 0;
+ }
+ else {
+ this.setDataAfterDiff({ fixed: false });
+ }
+ });
+ },
+ setDataAfterDiff(data) {
+ wx.nextTick(() => {
+ const diff = Object.keys(data).reduce((prev, key) => {
+ if (data[key] !== this.data[key]) {
+ prev[key] = data[key];
+ }
+ return prev;
+ }, {});
+ this.setData(diff);
+ this.$emit('scroll', {
+ scrollTop: this.scrollTop,
+ isFixed: data.fixed || this.data.fixed
+ });
+ });
+ },
getContainerRect() {
const nodesRef = this.data.container();
return new Promise(resolve => nodesRef.boundingClientRect(resolve).exec());
- },
- initObserver() {
- this.disconnectObserver();
- this.getRect(ROOT_ELEMENT).then((rect) => {
- this.setData({ height: rect.height });
- wx.nextTick(() => {
- this.observeContent();
- this.observeContainer();
- });
- });
- },
- updateFixed() {
- Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(([content, container]) => {
- this.setData({ height: content.height });
- this.containerHeight = container.height;
- wx.nextTick(() => {
- this.setFixed(content.top);
- });
- });
- },
- disconnectObserver(observerName) {
- if (observerName) {
- const observer = this[observerName];
- observer && observer.disconnect();
- }
- else {
- this.contentObserver && this.contentObserver.disconnect();
- this.containerObserver && this.containerObserver.disconnect();
- }
- },
- observeContent() {
- const { offsetTop } = this.data;
- this.disconnectObserver('contentObserver');
- const contentObserver = this.createIntersectionObserver({
- thresholds: [0.9, 1]
- });
- contentObserver.relativeToViewport({ top: -offsetTop });
- contentObserver.observe(ROOT_ELEMENT, res => {
- if (this.data.disabled) {
- return;
- }
- this.setFixed(res.boundingClientRect.top);
- });
- this.contentObserver = contentObserver;
- },
- observeContainer() {
- if (typeof this.data.container !== 'function') {
- return;
- }
- const { height } = this.data;
- this.getContainerRect().then((rect) => {
- this.containerHeight = rect.height;
- this.disconnectObserver('containerObserver');
- const containerObserver = this.createIntersectionObserver({
- thresholds: [0.9, 1]
- });
- this.containerObserver = containerObserver;
- containerObserver.relativeToViewport({
- top: this.containerHeight - height
- });
- containerObserver.observe(ROOT_ELEMENT, res => {
- if (this.data.disabled) {
- return;
- }
- this.setFixed(res.boundingClientRect.top);
- });
- });
- },
- setFixed(top) {
- const { offsetTop, height } = this.data;
- const { containerHeight } = this;
- const fixed = containerHeight && height
- ? top >= height - containerHeight && top < offsetTop
- : top < offsetTop;
- this.$emit('scroll', {
- scrollTop: top,
- isFixed: fixed
- });
- this.setData({ fixed });
}
- },
- mounted() {
- this.mounted = true;
- if (!this.data.disabled) {
- this.initObserver();
- }
- },
- destroyed() {
- this.disconnectObserver();
}
});
diff --git a/dist/sticky/index.wxml b/dist/sticky/index.wxml
index aa17a795..15e9f4a8 100644
--- a/dist/sticky/index.wxml
+++ b/dist/sticky/index.wxml
@@ -2,7 +2,7 @@
-
+
diff --git a/dist/sticky/index.wxs b/dist/sticky/index.wxs
index faa9570f..18efe147 100644
--- a/dist/sticky/index.wxs
+++ b/dist/sticky/index.wxs
@@ -1,18 +1,34 @@
/* eslint-disable */
function wrapStyle(data) {
- if (data.fixed) {
- return 'top: ' + data.offsetTop + 'px;';
+ var style = '';
+
+ if (data.transform) {
+ style += 'transform: translate3d(0, ' + data.transform + 'px, 0);';
}
- return '';
+ if (data.fixed) {
+ style += 'top: ' + data.offsetTop + 'px;';
+ }
+
+ if (data.zIndex) {
+ style += 'z-index: ' + data.zIndex + ';';
+ }
+
+ return style;
}
function containerStyle(data) {
+ var style = '';
+
if (data.fixed) {
- return 'height: ' + data.height + 'px; z-index: ' + data.zIndex + ';';
+ style += 'height: ' + data.height + 'px;';
}
- return '';
+ if (data.zIndex) {
+ style += 'z-index: ' + data.zIndex + ';';
+ }
+
+ return style;
}
module.exports = {
diff --git a/dist/tabs/index.wxml b/dist/tabs/index.wxml
index 9e8ca1ac..99ac4118 100644
--- a/dist/tabs/index.wxml
+++ b/dist/tabs/index.wxml
@@ -19,7 +19,7 @@
class="{{ utils.bem('tabs__scroll', [type]) }}"
style="{{ color ? 'border-color: ' + color : '' }}"
>
-
+
{{ item.name || item.url || item.path }}
+
+
+
+ {{ item.message }}
+
+
+
+
diff --git a/lib/sticky/index.js b/lib/sticky/index.js
index 62bd240c..f64bcb1a 100644
--- a/lib/sticky/index.js
+++ b/lib/sticky/index.js
@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
+var page_scroll_1 = require("../mixins/page-scroll");
var ROOT_ELEMENT = '.van-sticky';
component_1.VantComponent({
props: {
@@ -11,131 +12,96 @@ component_1.VantComponent({
offsetTop: {
type: Number,
value: 0,
- observer: 'observeContent'
+ observer: 'onScroll'
},
disabled: {
type: Boolean,
- observer: function (value) {
- if (!this.mounted) {
- return;
- }
- value ? this.disconnectObserver() : this.initObserver();
- }
+ observer: 'onScroll'
},
container: {
type: null,
- observer: function (target) {
- if (typeof target !== 'function' || !this.data.height) {
- return;
- }
- this.observeContainer();
- this.updateFixed();
- }
+ observer: 'onScroll'
}
},
+ mixins: [
+ page_scroll_1.pageScrollMixin(function (event) {
+ this.onScroll(event);
+ })
+ ],
data: {
height: 0,
- fixed: false
+ fixed: false,
+ transform: 0
+ },
+ mounted: function () {
+ this.onScroll();
},
methods: {
+ onScroll: function (_a) {
+ var _this = this;
+ var scrollTop = (_a === void 0 ? {} : _a).scrollTop;
+ var _b = this.data, container = _b.container, offsetTop = _b.offsetTop, disabled = _b.disabled;
+ if (disabled) {
+ this.setDataAfterDiff({
+ fixed: false,
+ transform: 0
+ });
+ return;
+ }
+ this.scrollTop = scrollTop || this.scrollTop;
+ if (typeof container === 'function') {
+ Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(function (_a) {
+ var root = _a[0], container = _a[1];
+ if (offsetTop + root.height > container.height + container.top) {
+ _this.setDataAfterDiff({
+ fixed: false,
+ transform: container.height - root.height
+ });
+ }
+ else if (offsetTop >= root.top) {
+ _this.setDataAfterDiff({
+ fixed: true,
+ height: root.height,
+ transform: 0
+ });
+ }
+ else {
+ _this.setDataAfterDiff({ fixed: false, transform: 0 });
+ }
+ });
+ return;
+ }
+ this.getRect(ROOT_ELEMENT).then(function (root) {
+ if (offsetTop >= root.top) {
+ _this.setDataAfterDiff({ fixed: true, height: root.height });
+ _this.transform = 0;
+ }
+ else {
+ _this.setDataAfterDiff({ fixed: false });
+ }
+ });
+ },
+ setDataAfterDiff: function (data) {
+ var _this = this;
+ wx.nextTick(function () {
+ var diff = Object.keys(data).reduce(function (prev, key) {
+ if (data[key] !== _this.data[key]) {
+ prev[key] = data[key];
+ }
+ return prev;
+ }, {});
+ _this.setData(diff);
+ _this.$emit('scroll', {
+ scrollTop: _this.scrollTop,
+ isFixed: data.fixed || _this.data.fixed
+ });
+ });
+ },
getContainerRect: function () {
var nodesRef = this.data.container();
return new Promise(function (resolve) {
return nodesRef.boundingClientRect(resolve).exec();
});
- },
- initObserver: function () {
- var _this = this;
- this.disconnectObserver();
- this.getRect(ROOT_ELEMENT).then(function (rect) {
- _this.setData({ height: rect.height });
- wx.nextTick(function () {
- _this.observeContent();
- _this.observeContainer();
- });
- });
- },
- updateFixed: function () {
- var _this = this;
- Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(function (_a) {
- var content = _a[0], container = _a[1];
- _this.setData({ height: content.height });
- _this.containerHeight = container.height;
- wx.nextTick(function () {
- _this.setFixed(content.top);
- });
- });
- },
- disconnectObserver: function (observerName) {
- if (observerName) {
- var observer = this[observerName];
- observer && observer.disconnect();
- }
- else {
- this.contentObserver && this.contentObserver.disconnect();
- this.containerObserver && this.containerObserver.disconnect();
- }
- },
- observeContent: function () {
- var _this = this;
- var offsetTop = this.data.offsetTop;
- this.disconnectObserver('contentObserver');
- var contentObserver = this.createIntersectionObserver({
- thresholds: [0.9, 1]
- });
- contentObserver.relativeToViewport({ top: -offsetTop });
- contentObserver.observe(ROOT_ELEMENT, function (res) {
- if (_this.data.disabled) {
- return;
- }
- _this.setFixed(res.boundingClientRect.top);
- });
- this.contentObserver = contentObserver;
- },
- observeContainer: function () {
- var _this = this;
- if (typeof this.data.container !== 'function') {
- return;
- }
- var height = this.data.height;
- this.getContainerRect().then(function (rect) {
- _this.containerHeight = rect.height;
- _this.disconnectObserver('containerObserver');
- var containerObserver = _this.createIntersectionObserver({
- thresholds: [0.9, 1]
- });
- _this.containerObserver = containerObserver;
- containerObserver.relativeToViewport({
- top: _this.containerHeight - height
- });
- containerObserver.observe(ROOT_ELEMENT, function (res) {
- if (_this.data.disabled) {
- return;
- }
- _this.setFixed(res.boundingClientRect.top);
- });
- });
- },
- setFixed: function (top) {
- var _a = this.data, offsetTop = _a.offsetTop, height = _a.height;
- var containerHeight = this.containerHeight;
- var fixed = containerHeight && height
- ? top >= height - containerHeight && top < offsetTop
- : top < offsetTop;
- this.$emit('scroll', {
- scrollTop: top,
- isFixed: fixed
- });
- this.setData({ fixed: fixed });
}
- },
- mounted: function () {
- this.mounted = true;
- if (!this.data.disabled) {
- this.initObserver();
- }
- },
- destroyed: function () {
- this.disconnectObserver();
}
});
diff --git a/lib/sticky/index.wxml b/lib/sticky/index.wxml
index aa17a795..15e9f4a8 100644
--- a/lib/sticky/index.wxml
+++ b/lib/sticky/index.wxml
@@ -2,7 +2,7 @@
-
+
diff --git a/lib/sticky/index.wxs b/lib/sticky/index.wxs
index faa9570f..18efe147 100644
--- a/lib/sticky/index.wxs
+++ b/lib/sticky/index.wxs
@@ -1,18 +1,34 @@
/* eslint-disable */
function wrapStyle(data) {
- if (data.fixed) {
- return 'top: ' + data.offsetTop + 'px;';
+ var style = '';
+
+ if (data.transform) {
+ style += 'transform: translate3d(0, ' + data.transform + 'px, 0);';
}
- return '';
+ if (data.fixed) {
+ style += 'top: ' + data.offsetTop + 'px;';
+ }
+
+ if (data.zIndex) {
+ style += 'z-index: ' + data.zIndex + ';';
+ }
+
+ return style;
}
function containerStyle(data) {
+ var style = '';
+
if (data.fixed) {
- return 'height: ' + data.height + 'px; z-index: ' + data.zIndex + ';';
+ style += 'height: ' + data.height + 'px;';
}
- return '';
+ if (data.zIndex) {
+ style += 'z-index: ' + data.zIndex + ';';
+ }
+
+ return style;
}
module.exports = {
diff --git a/lib/tabs/index.wxml b/lib/tabs/index.wxml
index 9e8ca1ac..99ac4118 100644
--- a/lib/tabs/index.wxml
+++ b/lib/tabs/index.wxml
@@ -19,7 +19,7 @@
class="{{ utils.bem('tabs__scroll', [type]) }}"
style="{{ color ? 'border-color: ' + color : '' }}"
>
-
+
{{ item.name || item.url || item.path }}
+
+
+
+ {{ item.message }}
+