first commit
This commit is contained in:
62
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-loading-icon/props.js
vendored
Normal file
62
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-loading-icon/props.js
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 是否显示组件
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.show
|
||||
},
|
||||
// 颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.color
|
||||
},
|
||||
// 提示文字颜色
|
||||
textColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.textColor
|
||||
},
|
||||
// 文字和图标是否垂直排列
|
||||
vertical: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.vertical
|
||||
},
|
||||
// 模式选择,circle-圆形,spinner-花朵形,semicircle-半圆形
|
||||
mode: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.mode
|
||||
},
|
||||
// 图标大小,单位默认px
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.size
|
||||
},
|
||||
// 文字大小
|
||||
textSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.textSize
|
||||
},
|
||||
// 文字内容
|
||||
text: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.text
|
||||
},
|
||||
// 动画模式
|
||||
timingFunction: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.timingFunction
|
||||
},
|
||||
// 动画执行周期时间
|
||||
duration: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.duration
|
||||
},
|
||||
// mode=circle时的暗边颜色
|
||||
inactiveColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingIcon.inactiveColor
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
148
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.acss
vendored
Normal file
148
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.acss
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
.u-empty.data-v-2af81691,
|
||||
.u-empty__wrap.data-v-2af81691,
|
||||
.u-tabs.data-v-2af81691,
|
||||
.u-tabs__wrapper.data-v-2af81691,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-2af81691,
|
||||
.u-tabs__wrapper__scroll-view.data-v-2af81691,
|
||||
.u-tabs__wrapper__nav.data-v-2af81691,
|
||||
.u-tabs__wrapper__nav__line.data-v-2af81691 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-loading-icon.data-v-2af81691 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #c8c9cc;
|
||||
}
|
||||
.u-loading-icon__text.data-v-2af81691 {
|
||||
margin-left: 4px;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.u-loading-icon__spinner.data-v-2af81691 {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
animation: u-rotate-2af81691 1s linear infinite;
|
||||
}
|
||||
.u-loading-icon__spinner--semicircle.data-v-2af81691 {
|
||||
border-width: 2px;
|
||||
border-color: transparent;
|
||||
border-top-right-radius: 100px;
|
||||
border-top-left-radius: 100px;
|
||||
border-bottom-left-radius: 100px;
|
||||
border-bottom-right-radius: 100px;
|
||||
border-style: solid;
|
||||
}
|
||||
.u-loading-icon__spinner--circle.data-v-2af81691 {
|
||||
border-top-right-radius: 100px;
|
||||
border-top-left-radius: 100px;
|
||||
border-bottom-left-radius: 100px;
|
||||
border-bottom-right-radius: 100px;
|
||||
border-width: 2px;
|
||||
border-top-color: #e5e5e5;
|
||||
border-right-color: #e5e5e5;
|
||||
border-bottom-color: #e5e5e5;
|
||||
border-left-color: #e5e5e5;
|
||||
border-style: solid;
|
||||
}
|
||||
.u-loading-icon--vertical.data-v-2af81691 {
|
||||
flex-direction: column;
|
||||
}
|
||||
.data-v-2af81691:host {
|
||||
font-size: 0px;
|
||||
line-height: 1;
|
||||
}
|
||||
.u-loading-icon__spinner--spinner.data-v-2af81691 {
|
||||
animation-timing-function: steps(12);
|
||||
}
|
||||
.u-loading-icon__text.data-v-2af81691:empty {
|
||||
display: none;
|
||||
}
|
||||
.u-loading-icon--vertical .u-loading-icon__text.data-v-2af81691 {
|
||||
margin: 6px 0 0;
|
||||
color: #606266;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:before {
|
||||
display: block;
|
||||
width: 2px;
|
||||
height: 25%;
|
||||
margin: 0 auto;
|
||||
background-color: currentColor;
|
||||
border-radius: 40%;
|
||||
content: " ";
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(1) {
|
||||
transform: rotate(30deg);
|
||||
opacity: 1;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(2) {
|
||||
transform: rotate(60deg);
|
||||
opacity: 0.9375;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(3) {
|
||||
transform: rotate(90deg);
|
||||
opacity: 0.875;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(4) {
|
||||
transform: rotate(120deg);
|
||||
opacity: 0.8125;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(5) {
|
||||
transform: rotate(150deg);
|
||||
opacity: 0.75;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(6) {
|
||||
transform: rotate(180deg);
|
||||
opacity: 0.6875;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(7) {
|
||||
transform: rotate(210deg);
|
||||
opacity: 0.625;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(8) {
|
||||
transform: rotate(240deg);
|
||||
opacity: 0.5625;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(9) {
|
||||
transform: rotate(270deg);
|
||||
opacity: 0.5;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(10) {
|
||||
transform: rotate(300deg);
|
||||
opacity: 0.4375;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(11) {
|
||||
transform: rotate(330deg);
|
||||
opacity: 0.375;
|
||||
}
|
||||
.u-loading-icon__dot.data-v-2af81691:nth-of-type(12) {
|
||||
transform: rotate(360deg);
|
||||
opacity: 0.3125;
|
||||
}
|
||||
@keyframes u-rotate-2af81691 {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view a:if="{{a}}" style="{{s}}" class="{{('u-loading-icon') + ' ' + 'data-v-2af81691' + ' ' + t}}"><view a:if="{{b}}" class="{{('u-loading-icon__spinner') + ' ' + 'data-v-2af81691' + ' ' + e}}" ref="ani" style="{{'color:' + f + ';' + ('width:' + g) + ';' + ('height:' + h) + ';' + ('border-top-color:' + i) + ';' + ('border-bottom-color:' + j) + ';' + ('border-left-color:' + k) + ';' + ('border-right-color:' + l) + ';' + ('animation-duration:' + m) + ';' + ('animation-timing-function:' + n)}}"><block a:if="{{c}}"><view a:for="{{d}}" a:for-item="item" a:key="a" class="u-loading-icon__dot data-v-2af81691"></view></block></view><text a:if="{{o}}" class="u-loading-icon__text data-v-2af81691" style="{{'font-size:' + q + ';' + ('color:' + r)}}">{{p}}</text></view>
|
||||
105
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.js
vendored
Normal file
105
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.js
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uLoadingIcon_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const uni_modules_uviewPlus_libs_function_colorGradient = require("../../libs/function/colorGradient.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-loading-icon",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uLoadingIcon_props.props],
|
||||
data() {
|
||||
return {
|
||||
// Array.form可以通过一个伪数组对象创建指定长度的数组
|
||||
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/from
|
||||
array12: Array.from({
|
||||
length: 12
|
||||
}),
|
||||
// 这里需要设置默认值为360,否则在安卓nvue上,会延迟一个duration周期后才执行
|
||||
// 在iOS nvue上,则会一开始默认执行两个周期的动画
|
||||
aniAngel: 360,
|
||||
// 动画旋转角度
|
||||
webviewHide: false,
|
||||
// 监听webview的状态,如果隐藏了页面,则停止动画,以免性能消耗
|
||||
loading: false
|
||||
// 是否运行中,针对nvue使用
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 当为circle类型时,给其另外三边设置一个更轻一些的颜色
|
||||
// 之所以需要这么做的原因是,比如父组件传了color为红色,那么需要另外的三个边为浅红色
|
||||
// 而不能是固定的某一个其他颜色(因为这个固定的颜色可能浅蓝,导致效果没有那么细腻良好)
|
||||
otherBorderColor() {
|
||||
const lightColor = uni_modules_uviewPlus_libs_function_colorGradient.colorGradient$1(this.color, "#ffffff", 100)[80];
|
||||
if (this.mode === "circle") {
|
||||
return this.inactiveColor ? this.inactiveColor : lightColor;
|
||||
} else {
|
||||
return "transparent";
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(n) {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
init() {
|
||||
setTimeout(() => {
|
||||
}, 20);
|
||||
},
|
||||
// 监听webview的显示与隐藏
|
||||
addEventListenerToWebview() {
|
||||
const pages = getCurrentPages();
|
||||
const page = pages[pages.length - 1];
|
||||
const currentWebview = page.$getAppWebview();
|
||||
currentWebview.addEventListener("hide", () => {
|
||||
this.webviewHide = true;
|
||||
});
|
||||
currentWebview.addEventListener("show", () => {
|
||||
this.webviewHide = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.show
|
||||
}, _ctx.show ? common_vendor.e({
|
||||
b: !$data.webviewHide
|
||||
}, !$data.webviewHide ? common_vendor.e({
|
||||
c: _ctx.mode === "spinner"
|
||||
}, _ctx.mode === "spinner" ? {
|
||||
d: common_vendor.f($data.array12, (item, index, i0) => {
|
||||
return {
|
||||
a: index
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
e: common_vendor.n(`u-loading-icon__spinner--${_ctx.mode}`),
|
||||
f: _ctx.color,
|
||||
g: $options.addUnit(_ctx.size),
|
||||
h: $options.addUnit(_ctx.size),
|
||||
i: _ctx.color,
|
||||
j: $options.otherBorderColor,
|
||||
k: $options.otherBorderColor,
|
||||
l: $options.otherBorderColor,
|
||||
m: `${_ctx.duration}ms`,
|
||||
n: _ctx.mode === "semicircle" || _ctx.mode === "circle" ? _ctx.timingFunction : ""
|
||||
}) : {}, {
|
||||
o: _ctx.text
|
||||
}, _ctx.text ? {
|
||||
p: common_vendor.t(_ctx.text),
|
||||
q: $options.addUnit(_ctx.textSize),
|
||||
r: _ctx.textColor
|
||||
} : {}, {
|
||||
s: common_vendor.s($options.addStyle(_ctx.customStyle)),
|
||||
t: common_vendor.n(_ctx.vertical && "u-loading-icon--vertical")
|
||||
}) : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2af81691"]]);
|
||||
my.createComponent(Component);
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {}
|
||||
}
|
||||
Reference in New Issue
Block a user