first commit
This commit is contained in:
26
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/computed.js
vendored
Normal file
26
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/computed.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_utils_wxs = require("../common/utils.wxs.js");
|
||||
function animate(options) {
|
||||
if (options.duration) {
|
||||
return uni_modules_tdesignUniapp_components_common_utils_wxs.tools._style({
|
||||
"transition-duration": `${options.duration}s`,
|
||||
transform: `translate3d( ${-100 * options.currentIndex}%,0, 0)`
|
||||
});
|
||||
}
|
||||
return "";
|
||||
}
|
||||
function trackStyle(options) {
|
||||
if (options.distance || options.lineWidth) {
|
||||
return uni_modules_tdesignUniapp_components_common_utils_wxs.tools._style({
|
||||
"-webkit-transform": `translateX(${options.distance}px)`,
|
||||
transform: `translateX(${options.distance}px)`,
|
||||
"transition-duration": options.isInit ? "0" : "0.3s",
|
||||
width: `${options.lineWidth}px`,
|
||||
opacity: 1
|
||||
});
|
||||
}
|
||||
return "";
|
||||
}
|
||||
exports.animate = animate;
|
||||
exports.trackStyle = trackStyle;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/computed.js.map
|
||||
78
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/props.js
vendored
Normal file
78
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/props.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
const props = {
|
||||
/** 动画效果设置。其中 duration 表示动画时长。(单位:秒) */
|
||||
animation: {
|
||||
type: Object
|
||||
},
|
||||
/** 激活下划线的模式 */
|
||||
bottomLineMode: {
|
||||
type: String,
|
||||
default: "fixed",
|
||||
validator(val) {
|
||||
if (!val)
|
||||
return true;
|
||||
return ["fixed", "auto", "full"].includes(val);
|
||||
}
|
||||
},
|
||||
/** 是否展示底部激活线条 */
|
||||
showBottomLine: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/** 选项卡头部空间是否均分 */
|
||||
spaceEvenly: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/** `1.1.10`。是否展示分割线 */
|
||||
split: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/** 是否开启粘性布局 */
|
||||
sticky: Boolean,
|
||||
/** 透传至 Sticky 组件 */
|
||||
stickyProps: {
|
||||
type: Object
|
||||
},
|
||||
/** 是否可以滑动切换 */
|
||||
swipeable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/** 标签的样式 */
|
||||
theme: {
|
||||
type: String,
|
||||
default: "line",
|
||||
validator(val) {
|
||||
if (!val)
|
||||
return true;
|
||||
return ["line", "tag", "card"].includes(val);
|
||||
}
|
||||
},
|
||||
/** 激活的选项卡值 */
|
||||
value: {
|
||||
type: [String, Number]
|
||||
},
|
||||
/** 激活的选项卡值,非受控属性 */
|
||||
defaultValue: {
|
||||
type: [String, Number]
|
||||
},
|
||||
/** 激活的选项卡发生变化时触发 */
|
||||
onChange: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
/** 点击选项卡时触发 */
|
||||
onClick: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
/** 页面滚动时触发 */
|
||||
onScroll: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/props.js.map
|
||||
428
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.js
vendored
Normal file
428
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.js
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_src_instantiationDecorator = require("../common/src/instantiationDecorator.js");
|
||||
const uni_modules_tdesignUniapp_components_tabs_props = require("./props.js");
|
||||
const uni_modules_tdesignUniapp_components_common_config = require("../common/config.js");
|
||||
const uni_modules_tdesignUniapp_components_mixins_touch = require("../mixins/touch.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
|
||||
const uni_modules_tdesignUniapp_components_common_wechat = require("../common/wechat.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils_wxs = require("../common/utils.wxs.js");
|
||||
const uni_modules_tdesignUniapp_components_common_relation_parentMap = require("../common/relation/parent-map.js");
|
||||
const uni_modules_tdesignUniapp_components_common_relation_relation = require("../common/relation/relation.js");
|
||||
const uni_modules_tdesignUniapp_components_tabs_computed = require("./computed.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const TSticky = () => "../sticky/sticky.js";
|
||||
const TBadge = () => "../badge/badge.js";
|
||||
const TIcon = () => "../icon/icon.js";
|
||||
const name = `${uni_modules_tdesignUniapp_components_common_config.prefix}-tabs`;
|
||||
const getUniqueID = uni_modules_tdesignUniapp_components_common_utils.uniqueFactory("tabs");
|
||||
const _sfc_main = uni_modules_tdesignUniapp_components_common_src_instantiationDecorator.uniComponent({
|
||||
name,
|
||||
options: {
|
||||
styleIsolation: "shared"
|
||||
},
|
||||
controlledProps: [{
|
||||
key: "value",
|
||||
event: "change"
|
||||
}],
|
||||
externalClasses: [
|
||||
`${uni_modules_tdesignUniapp_components_common_config.prefix}-class`,
|
||||
`${uni_modules_tdesignUniapp_components_common_config.prefix}-class-item`,
|
||||
`${uni_modules_tdesignUniapp_components_common_config.prefix}-class-active`,
|
||||
`${uni_modules_tdesignUniapp_components_common_config.prefix}-class-track`,
|
||||
`${uni_modules_tdesignUniapp_components_common_config.prefix}-class-content`
|
||||
],
|
||||
mixins: [uni_modules_tdesignUniapp_components_mixins_touch.touch, uni_modules_tdesignUniapp_components_common_relation_relation.ParentMixin(uni_modules_tdesignUniapp_components_common_relation_parentMap.RELATION_MAP.TabPanel)],
|
||||
components: {
|
||||
TSticky,
|
||||
TBadge,
|
||||
TIcon
|
||||
},
|
||||
props: {
|
||||
...uni_modules_tdesignUniapp_components_tabs_props.props
|
||||
},
|
||||
emits: [
|
||||
"change",
|
||||
"scroll",
|
||||
"error",
|
||||
"click"
|
||||
],
|
||||
watch: {
|
||||
value: {
|
||||
handler(e) {
|
||||
this.dataValue = e;
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
dataValue(name2) {
|
||||
if (name2 !== this.getCurrentName()) {
|
||||
this.setCurrentIndexByName(name2);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.children = this.children || [];
|
||||
},
|
||||
mounted() {
|
||||
uni_modules_tdesignUniapp_components_common_utils.nextTick().then(() => {
|
||||
this.setTrack();
|
||||
});
|
||||
uni_modules_tdesignUniapp_components_common_utils.getRect(this, `.${name}`).then((rect) => {
|
||||
this.containerWidth = rect.width;
|
||||
});
|
||||
this.tabID = getUniqueID();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
prefix: uni_modules_tdesignUniapp_components_common_config.prefix,
|
||||
classPrefix: name,
|
||||
tabs: [],
|
||||
currentLabels: [],
|
||||
currentIndex: -1,
|
||||
trackOption: {
|
||||
lineWidth: 0,
|
||||
distance: 0,
|
||||
isInit: true
|
||||
},
|
||||
offset: 0,
|
||||
scrollLeft: 0,
|
||||
tabID: "",
|
||||
placement: "top",
|
||||
tools: uni_modules_tdesignUniapp_components_common_utils_wxs.tools,
|
||||
dataValue: uni_modules_tdesignUniapp_components_common_utils.coalesce(this.value, this.defaultValue)
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
trackStyle: uni_modules_tdesignUniapp_components_tabs_computed.trackStyle,
|
||||
animate: uni_modules_tdesignUniapp_components_tabs_computed.animate,
|
||||
innerAfterLinked(target) {
|
||||
this.initChildId();
|
||||
target.dataIndex = this.children.length - 1;
|
||||
this.updateTabs();
|
||||
},
|
||||
innerAfterUnlinked(target) {
|
||||
this.children = this.children.filter((item) => item.index !== target.dataIndex);
|
||||
this.updateTabs(() => this.setTrack());
|
||||
this.initChildId();
|
||||
},
|
||||
initChildId() {
|
||||
this.children.forEach((item, index) => {
|
||||
item.setId(`${this.tabID}_panel_${index}`);
|
||||
});
|
||||
},
|
||||
onScroll(e = {}) {
|
||||
const { scrollLeft } = e.detail || {};
|
||||
this.scrollLeft = scrollLeft;
|
||||
},
|
||||
updateTabs(cb) {
|
||||
const { children } = this;
|
||||
const tabs = children.map((child) => {
|
||||
const { label, badgeProps, disabled, icon, panel, value, lazy } = child;
|
||||
return {
|
||||
label,
|
||||
badgeProps,
|
||||
disabled,
|
||||
icon,
|
||||
panel,
|
||||
value,
|
||||
lazy
|
||||
};
|
||||
});
|
||||
tabs.forEach((item) => {
|
||||
if (typeof item.icon === "string") {
|
||||
item.icon = { name: item.icon };
|
||||
}
|
||||
});
|
||||
this.tabs = tabs;
|
||||
if (typeof cb === "function") {
|
||||
setTimeout(cb, 33);
|
||||
}
|
||||
this.setCurrentIndexByName(this.dataValue);
|
||||
},
|
||||
setCurrentIndexByName(name2) {
|
||||
const { children } = this;
|
||||
const index = children.findIndex((child) => child.getComputedName() === `${name2}`);
|
||||
if (index > -1) {
|
||||
this.setCurrentIndex(index);
|
||||
}
|
||||
},
|
||||
setCurrentIndex(index) {
|
||||
if (index <= -1 || index >= this.children.length)
|
||||
return;
|
||||
const Labels = [];
|
||||
this.children.forEach((child, idx) => {
|
||||
const isActive = index === idx;
|
||||
if (isActive !== child.active || !child.initialized) {
|
||||
child.render(isActive, this);
|
||||
}
|
||||
Labels.push(child.label);
|
||||
});
|
||||
const { currentIndex, currentLabels } = this;
|
||||
if (currentIndex === index && currentLabels.join("") === Labels.join(""))
|
||||
return;
|
||||
this.currentIndex = index;
|
||||
this.currentLabels = Labels;
|
||||
setTimeout(() => {
|
||||
this.setTrack();
|
||||
}, 33);
|
||||
},
|
||||
getCurrentName() {
|
||||
if (this.children) {
|
||||
const activeTab = this.children[this.currentIndex];
|
||||
if (activeTab) {
|
||||
return activeTab.getComputedName();
|
||||
}
|
||||
}
|
||||
},
|
||||
calcScrollOffset(containerWidth, targetLeft, targetWidth, offset) {
|
||||
return offset + targetLeft - 1 / 2 * containerWidth + targetWidth / 2;
|
||||
},
|
||||
// 外部无法获取虚拟组件节点位置信息
|
||||
getTabHeight() {
|
||||
return uni_modules_tdesignUniapp_components_common_utils.getRect(this, `.${name}`);
|
||||
},
|
||||
getTrackSize() {
|
||||
const { bottomLineMode } = this;
|
||||
const targetMap = {
|
||||
fixed: `.${uni_modules_tdesignUniapp_components_common_config.prefix}-tabs__track`,
|
||||
auto: `.${uni_modules_tdesignUniapp_components_common_config.prefix}-tabs__item--active .${uni_modules_tdesignUniapp_components_common_config.prefix}-tabs__item-inner`,
|
||||
full: `.${uni_modules_tdesignUniapp_components_common_config.prefix}-tabs__item--active`
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.trackWidth) {
|
||||
resolve(this.trackWidth);
|
||||
return;
|
||||
}
|
||||
uni_modules_tdesignUniapp_components_common_utils.getRect(this, targetMap[bottomLineMode] || targetMap.fixed).then((res) => {
|
||||
if (res) {
|
||||
resolve(res.width);
|
||||
}
|
||||
}).catch(reject);
|
||||
});
|
||||
},
|
||||
async setTrack() {
|
||||
const { children } = this;
|
||||
if (!children)
|
||||
return;
|
||||
const { currentIndex } = this;
|
||||
if (currentIndex <= -1)
|
||||
return;
|
||||
try {
|
||||
const res = await uni_modules_tdesignUniapp_components_common_utils.getRect(this, `.${uni_modules_tdesignUniapp_components_common_config.prefix}-tabs__item`, true);
|
||||
const rect = res[currentIndex];
|
||||
if (!rect)
|
||||
return;
|
||||
let count = 0;
|
||||
let distance = 0;
|
||||
let totalSize = 0;
|
||||
res.forEach((item) => {
|
||||
if (count < currentIndex) {
|
||||
distance += item.width;
|
||||
count += 1;
|
||||
}
|
||||
totalSize += item.width;
|
||||
});
|
||||
if (this.containerWidth) {
|
||||
const offset = this.calcScrollOffset(this.containerWidth, rect.left, rect.width, this.scrollLeft);
|
||||
const maxOffset = totalSize - this.containerWidth;
|
||||
this.offset = Math.min(Math.max(offset, 0), maxOffset);
|
||||
} else if (!this._hasObserved) {
|
||||
this._hasObserved = true;
|
||||
uni_modules_tdesignUniapp_components_common_wechat.getObserver(this, `.${name}`).then(() => this.setTrack());
|
||||
}
|
||||
const lineWidth = await this.getTrackSize();
|
||||
if (this.theme === "line") {
|
||||
distance += (rect.width - lineWidth) / 2;
|
||||
}
|
||||
const isInit = this.previousIndex === void 0;
|
||||
if (isInit || this.previousIndex !== currentIndex || this.lastDistance !== distance) {
|
||||
this.previousIndex = currentIndex;
|
||||
this.trackOption = { lineWidth, distance, isInit };
|
||||
this.lastDistance = distance;
|
||||
}
|
||||
} catch (err) {
|
||||
this.$emit("error", err);
|
||||
}
|
||||
},
|
||||
onTabTap(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
this.changeIndex(index);
|
||||
},
|
||||
onTouchStart(event) {
|
||||
if (!this.swipeable)
|
||||
return;
|
||||
this.touchStart(event);
|
||||
},
|
||||
onTouchMove(event) {
|
||||
if (!this.swipeable)
|
||||
return;
|
||||
this.touchMove(event);
|
||||
},
|
||||
onTouchEnd() {
|
||||
if (!this.swipeable)
|
||||
return;
|
||||
const { direction, deltaX, offsetX } = this;
|
||||
const minSwipeDistance = 50;
|
||||
if (direction === "horizontal" && offsetX >= minSwipeDistance) {
|
||||
const index = this.getAvailableTabIndex(deltaX);
|
||||
if (index !== -1) {
|
||||
this.changeIndex(index);
|
||||
}
|
||||
}
|
||||
},
|
||||
onTouchScroll(event) {
|
||||
this._trigger("scroll", event);
|
||||
},
|
||||
changeIndex(index) {
|
||||
const currentTab = this.tabs[index];
|
||||
const { value, label } = currentTab;
|
||||
if (!(currentTab == null ? void 0 : currentTab.disabled) && index !== this.currentIndex) {
|
||||
this._trigger("change", { value, label });
|
||||
}
|
||||
this._trigger("click", { value, label });
|
||||
},
|
||||
getAvailableTabIndex(deltaX) {
|
||||
const step = deltaX > 0 ? -1 : 1;
|
||||
const { currentIndex, tabs } = this;
|
||||
const len = tabs.length;
|
||||
for (let i = step; currentIndex + step >= 0 && currentIndex + step < len; i += step) {
|
||||
const newIndex = currentIndex + i;
|
||||
if (newIndex >= 0 && newIndex < len && tabs[newIndex]) {
|
||||
if (!tabs[newIndex].disabled) {
|
||||
return newIndex;
|
||||
}
|
||||
} else {
|
||||
return currentIndex;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
getBadgeCustomStyle(item, index) {
|
||||
if (item.disabled) {
|
||||
return "--td-badge-content-text-color: var(--td-tab-item-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, .26))))";
|
||||
}
|
||||
if (this.currentIndex === index) {
|
||||
return "--td-badge-content-text-color: var(--td-tab-item-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));";
|
||||
}
|
||||
return "";
|
||||
},
|
||||
getIconCustomStyle(item) {
|
||||
return uni_modules_tdesignUniapp_components_common_utils_wxs.tools._style([
|
||||
{
|
||||
fontSize: "var(--td-tab-icon-size, 18px)",
|
||||
marginRight: "calc(var(--td-spacer, 8px) / 4)"
|
||||
},
|
||||
item.icon.style || ""
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!Array) {
|
||||
const _easycom_t_icon2 = common_vendor.resolveComponent("t-icon");
|
||||
const _easycom_t_badge2 = common_vendor.resolveComponent("t-badge");
|
||||
const _easycom_t_sticky2 = common_vendor.resolveComponent("t-sticky");
|
||||
(_easycom_t_icon2 + _easycom_t_badge2 + _easycom_t_sticky2)();
|
||||
}
|
||||
const _easycom_t_icon = () => "../icon/icon.js";
|
||||
const _easycom_t_badge = () => "../badge/badge.js";
|
||||
const _easycom_t_sticky = () => "../sticky/sticky.js";
|
||||
if (!Math) {
|
||||
(_easycom_t_icon + _easycom_t_badge + _easycom_t_sticky)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.f(_ctx.tabs, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: item.icon
|
||||
}, item.icon ? {
|
||||
b: common_vendor.o(($event) => item.icon.click || "", index),
|
||||
c: "7918ea5e-1-" + i0 + ",7918ea5e-0",
|
||||
d: common_vendor.p({
|
||||
["t-class"]: _ctx.classPrefix + "__icon",
|
||||
["custom-style"]: _ctx.getIconCustomStyle(item),
|
||||
prefix: item.icon.prefix,
|
||||
name: item.icon.name,
|
||||
size: item.icon.size,
|
||||
color: item.icon.color,
|
||||
["aria-hidden"]: !!item.icon.ariaHidden,
|
||||
["aria-label"]: item.icon.ariaLabel,
|
||||
["aria-role"]: item.icon.ariaRole
|
||||
})
|
||||
} : {}, {
|
||||
e: item.badgeProps
|
||||
}, item.badgeProps ? {
|
||||
f: "7918ea5e-2-" + i0 + ",7918ea5e-0",
|
||||
g: common_vendor.p({
|
||||
color: item.badgeProps.color || "",
|
||||
content: item.label,
|
||||
count: item.badgeProps.count || 0,
|
||||
dot: item.badgeProps.dot || false,
|
||||
["max-count"]: item.badgeProps.maxCount || 99,
|
||||
offset: item.badgeProps.offset || [],
|
||||
shape: item.badgeProps.shape || "circle",
|
||||
["show-zero"]: item.badgeProps.showZero || false,
|
||||
size: item.badgeProps.size || "medium",
|
||||
["t-class"]: _ctx.tools.cls(_ctx.classPrefix + "__badge", [["disabled", item.disabled], ["active", _ctx.currentIndex === index]]),
|
||||
["custom-style"]: _ctx.getBadgeCustomStyle(item, index),
|
||||
["t-class-content"]: item.badgeProps.tClassContent,
|
||||
["t-class-count"]: item.badgeProps.tClassCount
|
||||
})
|
||||
} : {
|
||||
h: common_vendor.t(item.label)
|
||||
}, {
|
||||
i: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__item-inner", [_ctx.theme, ["active", _ctx.currentIndex === index]])),
|
||||
j: item.badgeProps.dot || item.badgeProps.count,
|
||||
k: _ctx.theme == "card" && _ctx.currentIndex - 1 == index
|
||||
}, _ctx.theme == "card" && _ctx.currentIndex - 1 == index ? {
|
||||
l: common_vendor.n(_ctx.classPrefix + "__item-prefix")
|
||||
} : {}, {
|
||||
m: _ctx.theme == "card" && _ctx.currentIndex + 1 == index
|
||||
}, _ctx.theme == "card" && _ctx.currentIndex + 1 == index ? {
|
||||
n: common_vendor.n(_ctx.classPrefix + "__item-suffix")
|
||||
} : {}, {
|
||||
o: index,
|
||||
p: index,
|
||||
q: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__item", [_ctx.theme, ["evenly", _ctx.spaceEvenly], _ctx.placement, ["disabled", item.disabled], ["active", _ctx.currentIndex === index]]) + " " + (_ctx.currentIndex === index ? _ctx.tClassActive : "") + " " + _ctx.tClassItem),
|
||||
r: _ctx.tabID + "_panel_" + index,
|
||||
s: _ctx.currentIndex === index,
|
||||
t: item.disabled,
|
||||
v: _ctx.ariaLabel || (item.badgeProps.dot || item.badgeProps.count ? item.label + _ctx.tools.getBadgeAriaLabel({
|
||||
...item.badgeProps
|
||||
}) : ""),
|
||||
w: common_vendor.o((...args) => _ctx.onTabTap && _ctx.onTabTap(...args), index)
|
||||
});
|
||||
}),
|
||||
b: _ctx.theme == "line" && _ctx.showBottomLine
|
||||
}, _ctx.theme == "line" && _ctx.showBottomLine ? {
|
||||
c: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__track", [_ctx.placement]) + " " + _ctx.tClassTrack),
|
||||
d: common_vendor.s(_ctx.trackStyle(_ctx.trackOption))
|
||||
} : {}, {
|
||||
e: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__nav", [_ctx.placement, ["evenly", _ctx.spaceEvenly]])),
|
||||
f: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__scroll", [_ctx.placement, ["split", _ctx.split]])),
|
||||
g: _ctx.offset,
|
||||
h: common_vendor.o((...args) => _ctx.onScroll && _ctx.onScroll(...args)),
|
||||
i: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__wrapper", [_ctx.theme])),
|
||||
j: common_vendor.o(_ctx.onTouchScroll),
|
||||
k: common_vendor.p({
|
||||
["t-class"]: _ctx.tools.cls(_ctx.classPrefix + "__sticky", [_ctx.placement]),
|
||||
disabled: !_ctx.sticky,
|
||||
["z-index"]: _ctx.stickyProps && _ctx.stickyProps.zIndex || 1,
|
||||
["offset-top"]: _ctx.stickyProps && _ctx.stickyProps.offsetTop || 0,
|
||||
container: _ctx.stickyProps && _ctx.stickyProps.container
|
||||
}),
|
||||
l: common_vendor.n(_ctx.classPrefix + "__content-inner " + _ctx.tClassContent),
|
||||
m: common_vendor.s(_ctx.animate({
|
||||
duration: _ctx.animation && _ctx.animation.duration,
|
||||
currentIndex: _ctx.currentIndex
|
||||
})),
|
||||
n: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__content", [["animated", _ctx.animation]])),
|
||||
o: common_vendor.o((...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
||||
p: common_vendor.o((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
||||
q: common_vendor.o((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
||||
r: common_vendor.o((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
||||
s: common_vendor.s(_ctx.tools._style([_ctx.customStyle])),
|
||||
t: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix, [_ctx.placement]) + " " + _ctx.tClass)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7918ea5e"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.js.map
|
||||
8
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.json
vendored
Normal file
8
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-sticky": "../sticky/sticky",
|
||||
"t-badge": "../badge/badge",
|
||||
"t-icon": "../icon/icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view style="{{s}}" class="{{['data-v-7918ea5e', t]}}"><t-sticky wx:if="{{k}}" class="data-v-7918ea5e" u-s="{{['d']}}" bindscroll="{{j}}" u-i="7918ea5e-0" bind:__l="__l" u-p="{{k}}"><view class="{{['data-v-7918ea5e', i]}}"><scroll-view class="{{['data-v-7918ea5e', f]}}" enhanced enable-flex scroll-left="{{g}}" scroll-x="{{true}}" scroll-anchoring scroll-with-animation enable-passive show-scrollbar="{{false}}" type="list" bindscroll="{{h}}"><view class="{{['data-v-7918ea5e', e]}}" aria-role="tablist"><view wx:for="{{a}}" wx:for-item="item" wx:key="o" data-index="{{item.p}}" class="{{['data-v-7918ea5e', item.q]}}" aria-role="tab" aria-controls="{{item.r}}" aria-selected="{{item.s}}" aria-disabled="{{item.t}}" aria-label="{{item.v}}" bindtap="{{item.w}}"><view class="{{['data-v-7918ea5e', item.i]}}" aria-hidden="{{item.j}}"><block wx:if="{{item.a}}" name="icon"><t-icon wx:if="{{item.d}}" class="data-v-7918ea5e" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d}}"/></block><block wx:if="{{item.e}}"><t-badge wx:if="{{item.g}}" class="data-v-7918ea5e" u-i="{{item.f}}" bind:__l="__l" u-p="{{item.g}}"/></block><block wx:else>{{item.h}}</block></view><view wx:if="{{item.k}}" class="{{['data-v-7918ea5e', item.l]}}"/><view wx:if="{{item.m}}" class="{{['data-v-7918ea5e', item.n]}}"/></view><view wx:if="{{b}}" class="{{['data-v-7918ea5e', c]}}" style="{{d}}"/></view></scroll-view></view></t-sticky><slot name="middle"/><view class="{{['data-v-7918ea5e', n]}}" bindtouchstart="{{o}}" bindtouchmove="{{p}}" bindtouchend="{{q}}" bindtouchcancel="{{r}}"><view class="{{['data-v-7918ea5e', l]}}" style="{{m}}"><slot/></view></view></view>
|
||||
195
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.wxss
vendored
Normal file
195
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/tabs/tabs.wxss
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
.t-tabs.data-v-7918ea5e {
|
||||
position: relative;
|
||||
font: var(--td-tab-font, var(--td-font-body-medium, 28rpx / 44rpx var(--td-font-family, PingFang SC, Microsoft YaHei, Arial Regular)));
|
||||
background: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.t-tabs__wrapper.data-v-7918ea5e {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
background: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
|
||||
}
|
||||
.t-tabs__wrapper--card.data-v-7918ea5e {
|
||||
background: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
|
||||
--td-tab-border-color: transparent;
|
||||
}
|
||||
.t-tabs__item.data-v-7918ea5e {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 400;
|
||||
color: var(--td-tab-item-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
|
||||
padding: 0 var(--td-spacer-2, 32rpx);
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
height: var(--td-tab-item-height, 96rpx);
|
||||
}
|
||||
.t-tabs__item--active.data-v-7918ea5e {
|
||||
font-weight: 600;
|
||||
color: var(--td-tab-item-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
||||
}
|
||||
.t-tabs__item--disabled.data-v-7918ea5e {
|
||||
color: var(--td-tab-item-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
|
||||
}
|
||||
.t-tabs__item--evenly.data-v-7918ea5e {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
.t-tabs__item-inner.data-v-7918ea5e {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.t-tabs__item-inner--tag.data-v-7918ea5e {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 0 var(--td-spacer-2, 32rpx);
|
||||
line-height: var(--td-tab-item-tag-height, 64rpx);
|
||||
border-radius: calc(var(--td-tab-item-tag-height, 64rpx) / 2);
|
||||
background-color: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
|
||||
}
|
||||
.t-tabs__item-inner--active.t-tabs__item-inner--tag.data-v-7918ea5e {
|
||||
background-color: var(--td-tab-item-tag-active-bg, var(--td-brand-color-light, var(--td-primary-color-1, #f2f3ff)));
|
||||
}
|
||||
.t-tabs__item--tag.data-v-7918ea5e:not(.t-tabs__item--evenly) {
|
||||
padding: 0 calc(var(--td-spacer, 16rpx) / 2);
|
||||
}
|
||||
.t-tabs__item--tag.data-v-7918ea5e:not(.t-tabs__item--evenly):first-child {
|
||||
margin-left: var(--td-spacer, 16rpx);
|
||||
}
|
||||
.t-tabs__item--tag.data-v-7918ea5e:not(.t-tabs__item--evenly):last-child {
|
||||
padding-right: var(--td-spacer-1, 24rpx);
|
||||
}
|
||||
.t-tabs__item--tag.data-v-7918ea5e {
|
||||
padding: 0 var(--td-spacer, 16rpx);
|
||||
}
|
||||
.t-tabs__item--card.t-tabs__item--active.data-v-7918ea5e {
|
||||
background-color: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
|
||||
border-radius: var(--td-radius-large, 18rpx) var(--td-radius-large, 18rpx) 0 0;
|
||||
}
|
||||
.t-tabs__item--card.t-tabs__item--active.data-v-7918ea5e:first-child {
|
||||
border-top-left-radius: 0;
|
||||
}
|
||||
.t-tabs__item--card.t-tabs__item--active.data-v-7918ea5e:last-child {
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
.t-tabs__item--card.t-tabs__item--pre.data-v-7918ea5e {
|
||||
border-bottom-right-radius: var(--td-radius-large, 18rpx);
|
||||
}
|
||||
.t-tabs__item-prefix.data-v-7918ea5e,
|
||||
.t-tabs__item-suffix.data-v-7918ea5e {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
background-color: var(--td-tab-nav-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
|
||||
}
|
||||
.t-tabs__item-prefix.data-v-7918ea5e::after,
|
||||
.t-tabs__item-suffix.data-v-7918ea5e::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: var(--td-tab-item-tag-bg, var(--td-bg-color-secondarycontainer, var(--td-gray-color-1, #f3f3f3)));
|
||||
}
|
||||
.t-tabs__item-prefix.data-v-7918ea5e {
|
||||
right: 0;
|
||||
}
|
||||
.t-tabs__item-prefix.data-v-7918ea5e::after {
|
||||
border-bottom-right-radius: var(--td-radius-large, 18rpx);
|
||||
}
|
||||
.t-tabs__item-suffix.data-v-7918ea5e {
|
||||
left: 0;
|
||||
}
|
||||
.t-tabs__item-suffix.data-v-7918ea5e::after {
|
||||
border-bottom-left-radius: var(--td-radius-large, 18rpx);
|
||||
}
|
||||
.t-tabs__badge--active.data-v-7918ea5e {
|
||||
--td-badge-content-text-color: var(--td-tab-item-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
||||
}
|
||||
.t-tabs__badge--disabled.data-v-7918ea5e {
|
||||
--td-badge-content-text-color: var(--td-tab-item-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
|
||||
}
|
||||
.t-tabs__icon.data-v-7918ea5e {
|
||||
font-size: var(--td-tab-icon-size, 36rpx);
|
||||
margin-right: calc(var(--td-spacer, 16rpx) / 4);
|
||||
}
|
||||
.t-tabs__content.data-v-7918ea5e {
|
||||
overflow: hidden;
|
||||
}
|
||||
.t-tabs__nav.data-v-7918ea5e {
|
||||
position: relative;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
.t-tabs__nav.t-tabs__nav--evenly.data-v-7918ea5e {
|
||||
width: 100%;
|
||||
}
|
||||
.t-tabs__track.data-v-7918ea5e {
|
||||
position: absolute;
|
||||
font-weight: 600;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
background-color: var(--td-tab-track-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
||||
left: 0;
|
||||
bottom: 1rpx;
|
||||
width: var(--td-tab-track-width, 32rpx);
|
||||
height: var(--td-tab-track-thickness, 6rpx);
|
||||
border-radius: var(--td-tab-track-radius, 8rpx);
|
||||
}
|
||||
.t-tabs__scroll.data-v-7918ea5e {
|
||||
position: relative;
|
||||
height: var(--td-tab-item-height, 96rpx);
|
||||
}
|
||||
.t-tabs__scroll--split.data-v-7918ea5e {
|
||||
position: relative;
|
||||
}
|
||||
.t-tabs__scroll--split.data-v-7918ea5e::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: unset;
|
||||
bottom: 0;
|
||||
left: unset;
|
||||
right: unset;
|
||||
background-color: var(--td-tab-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7)));
|
||||
}
|
||||
.t-tabs__scroll--split.data-v-7918ea5e::after {
|
||||
height: 1px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
.t-tabs__scroll.data-v-7918ea5e::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.t-tabs__content.data-v-7918ea5e {
|
||||
width: 100%;
|
||||
}
|
||||
.t-tabs__content-inner.data-v-7918ea5e {
|
||||
display: block;
|
||||
}
|
||||
.t-tabs__content--animated .t-tabs__content-inner.data-v-7918ea5e {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
will-change: left;
|
||||
transition-property: transform;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user