111
This commit is contained in:
Vendored
+204
@@ -0,0 +1,204 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-steps-item",
|
||||
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$18],
|
||||
data() {
|
||||
return {
|
||||
index: 0,
|
||||
childLength: 0,
|
||||
showLine: false,
|
||||
size: {
|
||||
height: 0,
|
||||
width: 0
|
||||
},
|
||||
parentData: {
|
||||
direction: "row",
|
||||
current: 0,
|
||||
activeColor: "",
|
||||
inactiveColor: "",
|
||||
activeIcon: "",
|
||||
inactiveIcon: "",
|
||||
dot: false
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"parentData"(newValue, oldValue) {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
computed: {
|
||||
lineStyle() {
|
||||
var _a, _b;
|
||||
const style = {};
|
||||
if (this.parentData.direction === "row") {
|
||||
style.width = this.size.width + "px";
|
||||
style.left = this.size.width / 2 + "px";
|
||||
} else {
|
||||
style.height = this.size.height + "px";
|
||||
}
|
||||
style.backgroundColor = ((_b = (_a = this.parent.children) == null ? void 0 : _a[this.index + 1]) == null ? void 0 : _b.error) ? common_vendor.color.error : this.index < this.parentData.current ? this.parentData.activeColor : this.parentData.inactiveColor;
|
||||
return style;
|
||||
},
|
||||
itemStyleInner() {
|
||||
return {
|
||||
...this.itemStyle
|
||||
};
|
||||
},
|
||||
statusClass() {
|
||||
const {
|
||||
index,
|
||||
error
|
||||
} = this;
|
||||
const {
|
||||
current
|
||||
} = this.parentData;
|
||||
if (current == index) {
|
||||
return error === true ? "error" : "process";
|
||||
} else if (error) {
|
||||
return "error";
|
||||
} else if (current > index) {
|
||||
return "finish";
|
||||
} else {
|
||||
return "wait";
|
||||
}
|
||||
},
|
||||
statusColor() {
|
||||
let colorTmp = "";
|
||||
switch (this.statusClass) {
|
||||
case "finish":
|
||||
colorTmp = this.parentData.activeColor;
|
||||
break;
|
||||
case "error":
|
||||
colorTmp = common_vendor.color.error;
|
||||
break;
|
||||
case "process":
|
||||
colorTmp = this.parentData.dot ? this.parentData.activeColor : "transparent";
|
||||
break;
|
||||
default:
|
||||
colorTmp = this.parentData.inactiveColor;
|
||||
break;
|
||||
}
|
||||
return colorTmp;
|
||||
},
|
||||
contentStyle() {
|
||||
const style = {};
|
||||
if (this.parentData.direction === "column") {
|
||||
style.marginLeft = this.parentData.dot ? "2px" : "6px";
|
||||
style.marginTop = this.parentData.dot ? "0px" : "6px";
|
||||
} else {
|
||||
style.marginTop = this.parentData.dot ? "2px" : "6px";
|
||||
style.marginLeft = this.parentData.dot ? "2px" : "6px";
|
||||
}
|
||||
return style;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.parent && this.parent.updateFromChild();
|
||||
common_vendor.sleep().then(() => {
|
||||
this.getStepsItemRect();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.updateParentData();
|
||||
if (!this.parent) {
|
||||
return common_vendor.error("u-steps-item必须要搭配u-steps组件使用");
|
||||
}
|
||||
this.index = this.parent.children.indexOf(this);
|
||||
this.childLength = this.parent.children.length;
|
||||
},
|
||||
updateParentData() {
|
||||
this.getParentData("u-steps");
|
||||
},
|
||||
// 父组件数据发生变化
|
||||
updateFromParent() {
|
||||
this.init();
|
||||
},
|
||||
// 获取组件的尺寸,用于设置横线的位置
|
||||
getStepsItemRect() {
|
||||
this.$uGetRect(".u-steps-item").then((size) => {
|
||||
this.size = size;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
|
||||
const _easycom_up_text2 = common_vendor.resolveComponent("up-text");
|
||||
(_easycom_u_icon2 + _easycom_up_text2)();
|
||||
}
|
||||
const _easycom_u_icon = () => "../u-icon/u-icon.js";
|
||||
const _easycom_up_text = () => "../u-text/u-text.js";
|
||||
if (!Math) {
|
||||
(_easycom_u_icon + _easycom_up_text)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.index + 1 < $data.childLength
|
||||
}, $data.index + 1 < $data.childLength ? {
|
||||
b: common_vendor.n(`u-steps-item__line--${$data.parentData.direction}`),
|
||||
c: common_vendor.s($options.lineStyle)
|
||||
} : {}, {
|
||||
d: $data.parentData.dot
|
||||
}, $data.parentData.dot ? {
|
||||
e: $options.statusColor
|
||||
} : $data.parentData.activeIcon || $data.parentData.inactiveIcon ? {
|
||||
g: common_vendor.p({
|
||||
name: $data.index <= $data.parentData.current ? $data.parentData.activeIcon : $data.parentData.inactiveIcon,
|
||||
size: _ctx.iconSize,
|
||||
color: $data.index <= $data.parentData.current ? $data.parentData.activeColor : $data.parentData.inactiveColor
|
||||
})
|
||||
} : common_vendor.e({
|
||||
h: $options.statusClass === "process" || $options.statusClass === "wait"
|
||||
}, $options.statusClass === "process" || $options.statusClass === "wait" ? {
|
||||
i: common_vendor.t($data.index + 1),
|
||||
j: $data.index == $data.parentData.current ? "#ffffff" : $data.parentData.inactiveColor
|
||||
} : {
|
||||
k: common_vendor.p({
|
||||
color: $options.statusClass === "error" ? "error" : $data.parentData.activeColor,
|
||||
size: "12",
|
||||
name: $options.statusClass === "error" ? "close" : "checkmark"
|
||||
})
|
||||
}, {
|
||||
l: $options.statusClass === "process" ? $data.parentData.activeColor : "transparent",
|
||||
m: $options.statusColor
|
||||
}), {
|
||||
f: $data.parentData.activeIcon || $data.parentData.inactiveIcon,
|
||||
n: common_vendor.n(`u-steps-item__wrapper--${$data.parentData.direction}`),
|
||||
o: common_vendor.n($data.parentData.dot && `u-steps-item__wrapper--${$data.parentData.direction}--dot`),
|
||||
p: common_vendor.s($options.itemStyleInner),
|
||||
q: common_vendor.r("content", {
|
||||
index: $data.index
|
||||
}),
|
||||
r: !_ctx.$slots["content"]
|
||||
}, !_ctx.$slots["content"] ? common_vendor.e({
|
||||
s: !_ctx.$slots["title"]
|
||||
}, !_ctx.$slots["title"] ? {
|
||||
t: common_vendor.p({
|
||||
text: _ctx.title,
|
||||
type: $data.parentData.current == $data.index ? "main" : "content",
|
||||
lineHeight: "20px",
|
||||
size: $data.parentData.current == $data.index ? 14 : 13
|
||||
})
|
||||
} : {}, {
|
||||
v: !_ctx.$slots["desc"]
|
||||
}, !_ctx.$slots["desc"] ? {
|
||||
w: common_vendor.p({
|
||||
text: _ctx.desc,
|
||||
type: "tips",
|
||||
size: "12"
|
||||
})
|
||||
} : {}) : {}, {
|
||||
x: common_vendor.n(`u-steps-item__content--${$data.parentData.direction}`),
|
||||
y: common_vendor.n($data.parentData.current == $data.index ? "u-steps-item__content--current" : ""),
|
||||
z: common_vendor.s($options.contentStyle),
|
||||
A: common_vendor.n(`u-steps-item--${$data.parentData.direction}`)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9f07ce7c"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/node-modules/uview-plus/components/u-steps-item/u-steps-item.js.map
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-icon": "../u-icon/u-icon",
|
||||
"up-text": "../u-text/u-text"
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<view ref="u-steps-item" class="{{['u-steps-item', 'data-v-9f07ce7c', A]}}"><view wx:if="{{a}}" class="{{['u-steps-item__line', 'data-v-9f07ce7c', b]}}" style="{{c}}"></view><view class="{{['u-steps-item__wrapper', 'data-v-9f07ce7c', n, o]}}" style="{{p}}"><block wx:if="{{$slots.icon}}"><slot name="icon"></slot></block><block wx:else><view wx:if="{{d}}" class="u-steps-item__wrapper__dot data-v-9f07ce7c" style="{{'background-color:' + e}}"></view><view wx:elif="{{f}}" class="u-steps-item__wrapper__icon data-v-9f07ce7c"><u-icon wx:if="{{g}}" class="data-v-9f07ce7c" u-i="9f07ce7c-0" bind:__l="__l" u-p="{{g}}"></u-icon></view><view wx:else style="{{'background-color:' + l + ';' + ('border-color:' + m)}}" class="u-steps-item__wrapper__circle data-v-9f07ce7c"><text wx:if="{{h}}" class="u-steps-item__wrapper__circle__text data-v-9f07ce7c" style="{{'color:' + j}}">{{i}}</text><u-icon wx:else class="data-v-9f07ce7c" u-i="9f07ce7c-1" bind:__l="__l" u-p="{{k||''}}"></u-icon></view></block></view><view class="{{['u-steps-item__content', 'data-v-9f07ce7c', x, y]}}" style="{{z}}"><slot name="content"></slot><block wx:if="{{r}}"><view class="u-steps-item__content__title data-v-9f07ce7c"><slot name="title"></slot><up-text wx:if="{{s}}" class="data-v-9f07ce7c" u-i="9f07ce7c-2" bind:__l="__l" u-p="{{t}}"></up-text></view><view class="u-steps-item__content__desc data-v-9f07ce7c"><slot name="desc"></slot><up-text wx:if="{{v}}" class="data-v-9f07ce7c" u-i="9f07ce7c-3" bind:__l="__l" u-p="{{w}}"></up-text></view></block></view></view>
|
||||
Vendored
+146
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.u-empty.data-v-9f07ce7c,
|
||||
.u-empty__wrap.data-v-9f07ce7c,
|
||||
.u-tabs.data-v-9f07ce7c,
|
||||
.u-tabs__wrapper.data-v-9f07ce7c,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-9f07ce7c,
|
||||
.u-tabs__wrapper__scroll-view.data-v-9f07ce7c,
|
||||
.u-tabs__wrapper__nav.data-v-9f07ce7c,
|
||||
.u-tabs__wrapper__nav__line.data-v-9f07ce7c,
|
||||
.up-empty.data-v-9f07ce7c,
|
||||
.up-empty__wrap.data-v-9f07ce7c,
|
||||
.up-tabs.data-v-9f07ce7c,
|
||||
.up-tabs__wrapper.data-v-9f07ce7c,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-9f07ce7c,
|
||||
.up-tabs__wrapper__scroll-view.data-v-9f07ce7c,
|
||||
.up-tabs__wrapper__nav.data-v-9f07ce7c,
|
||||
.up-tabs__wrapper__nav__line.data-v-9f07ce7c {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-steps-item.data-v-9f07ce7c {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.u-steps-item--row.data-v-9f07ce7c {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
.u-steps-item--column.data-v-9f07ce7c {
|
||||
position: relative;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.u-steps-item__wrapper.data-v-9f07ce7c {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.u-steps-item__wrapper--column.data-v-9f07ce7c {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.u-steps-item__wrapper--column--dot.data-v-9f07ce7c {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
.u-steps-item__wrapper--row.data-v-9f07ce7c {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.u-steps-item__wrapper--row--dot.data-v-9f07ce7c {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.u-steps-item__wrapper__circle.data-v-9f07ce7c {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
border-radius: 100px;
|
||||
border-width: 1px;
|
||||
border-color: #909193;
|
||||
border-style: solid;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
.u-steps-item__wrapper__circle__text.data-v-9f07ce7c {
|
||||
color: #909193;
|
||||
font-size: 11px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
line-height: 11px;
|
||||
}
|
||||
.u-steps-item__wrapper__dot.data-v-9f07ce7c {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 100px;
|
||||
background-color: #606266;
|
||||
}
|
||||
.u-steps-item__content.data-v-9f07ce7c {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
}
|
||||
.u-steps-item__content--row.data-v-9f07ce7c {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.u-steps-item__content--column.data-v-9f07ce7c {
|
||||
flex-direction: column;
|
||||
margin-left: 6px;
|
||||
}
|
||||
.u-steps-item__line.data-v-9f07ce7c {
|
||||
position: absolute;
|
||||
background: #909193;
|
||||
}
|
||||
.u-steps-item__line--row.data-v-9f07ce7c {
|
||||
top: 10px;
|
||||
height: 1px;
|
||||
}
|
||||
.u-steps-item__line--column.data-v-9f07ce7c {
|
||||
width: 1px;
|
||||
left: 10px;
|
||||
}
|
||||
Reference in New Issue
Block a user