first commit
This commit is contained in:
77
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/props.js
vendored
Normal file
77
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/props.js
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// checkbox的名称
|
||||
name: {
|
||||
type: [String, Number, Boolean],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.name
|
||||
},
|
||||
// 形状,square为方形,circle为圆型
|
||||
shape: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.shape
|
||||
},
|
||||
// 整体的大小
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.size
|
||||
},
|
||||
// 是否默认选中
|
||||
checked: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.checked
|
||||
},
|
||||
// 是否禁用
|
||||
disabled: {
|
||||
type: [String, Boolean],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.disabled
|
||||
},
|
||||
// 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.activeColor
|
||||
},
|
||||
// 未选中的颜色
|
||||
inactiveColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.inactiveColor
|
||||
},
|
||||
// 图标的大小,单位px
|
||||
iconSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.iconSize
|
||||
},
|
||||
// 图标颜色
|
||||
iconColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.iconColor
|
||||
},
|
||||
// label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式
|
||||
label: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.label
|
||||
},
|
||||
// label的字体大小,px单位
|
||||
labelSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.labelSize
|
||||
},
|
||||
// label的颜色
|
||||
labelColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.labelColor
|
||||
},
|
||||
// 是否禁止点击提示语选中复选框
|
||||
labelDisabled: {
|
||||
type: [String, Boolean],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.checkbox.labelDisabled
|
||||
},
|
||||
// 是否独立使用
|
||||
usedAlone: {
|
||||
type: [Boolean],
|
||||
default: () => false
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
213
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.js
vendored
Normal file
213
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.js
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uCheckbox_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_test = require("../../libs/function/test.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-checkbox",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uCheckbox_props.props],
|
||||
data() {
|
||||
return {
|
||||
isChecked: false,
|
||||
// 父组件的默认值,因为头条小程序不支持在computed中使用this.parent.shape的形式
|
||||
// 故只能使用如此方法
|
||||
parentData: {
|
||||
iconSize: 12,
|
||||
labelDisabled: null,
|
||||
disabled: null,
|
||||
shape: "square",
|
||||
activeColor: null,
|
||||
inactiveColor: null,
|
||||
size: 18,
|
||||
modelValue: null,
|
||||
iconColor: null,
|
||||
placement: "row",
|
||||
borderBottom: false,
|
||||
iconPlacement: "left"
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否禁用,如果父组件u-raios-group禁用的话,将会忽略子组件的配置
|
||||
elDisabled() {
|
||||
return this.disabled !== "" ? this.disabled : this.parentData.disabled !== null ? this.parentData.disabled : false;
|
||||
},
|
||||
// 是否禁用label点击
|
||||
elLabelDisabled() {
|
||||
return this.labelDisabled !== "" ? this.labelDisabled : this.parentData.labelDisabled !== null ? this.parentData.labelDisabled : false;
|
||||
},
|
||||
// 组件尺寸,对应size的值,默认值为21px
|
||||
elSize() {
|
||||
return this.size ? this.size : this.parentData.size ? this.parentData.size : 21;
|
||||
},
|
||||
// 组件的勾选图标的尺寸,默认12px
|
||||
elIconSize() {
|
||||
return this.iconSize ? this.iconSize : this.parentData.iconSize ? this.parentData.iconSize : 12;
|
||||
},
|
||||
// 组件选中激活时的颜色
|
||||
elActiveColor() {
|
||||
return this.activeColor ? this.activeColor : this.parentData.activeColor ? this.parentData.activeColor : "#2979ff";
|
||||
},
|
||||
// 组件选未中激活时的颜色
|
||||
elInactiveColor() {
|
||||
return this.inactiveColor ? this.inactiveColor : this.parentData.inactiveColor ? this.parentData.inactiveColor : "#c8c9cc";
|
||||
},
|
||||
// label的颜色
|
||||
elLabelColor() {
|
||||
return this.labelColor ? this.labelColor : this.parentData.labelColor ? this.parentData.labelColor : "#606266";
|
||||
},
|
||||
// 组件的形状
|
||||
elShape() {
|
||||
return this.shape ? this.shape : this.parentData.shape ? this.parentData.shape : "circle";
|
||||
},
|
||||
// label大小
|
||||
elLabelSize() {
|
||||
return uni_modules_uviewPlus_libs_function_index.addUnit(this.labelSize ? this.labelSize : this.parentData.labelSize ? this.parentData.labelSize : "15");
|
||||
},
|
||||
elIconColor() {
|
||||
const iconColor = this.iconColor ? this.iconColor : this.parentData.iconColor ? this.parentData.iconColor : "#ffffff";
|
||||
if (this.elDisabled) {
|
||||
return this.isChecked ? this.elInactiveColor : "transparent";
|
||||
} else {
|
||||
return this.isChecked ? iconColor : "transparent";
|
||||
}
|
||||
},
|
||||
iconClasses() {
|
||||
let classes = [];
|
||||
classes.push("u-checkbox__icon-wrap--" + this.elShape);
|
||||
if (this.elDisabled) {
|
||||
classes.push("u-checkbox__icon-wrap--disabled");
|
||||
}
|
||||
if (this.isChecked && this.elDisabled) {
|
||||
classes.push("u-checkbox__icon-wrap--disabled--checked");
|
||||
}
|
||||
return classes;
|
||||
},
|
||||
iconWrapStyle() {
|
||||
const style = {};
|
||||
style.backgroundColor = this.isChecked && !this.elDisabled ? this.elActiveColor : "#ffffff";
|
||||
style.borderColor = this.isChecked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor;
|
||||
style.width = uni_modules_uviewPlus_libs_function_index.addUnit(this.elSize);
|
||||
style.height = uni_modules_uviewPlus_libs_function_index.addUnit(this.elSize);
|
||||
if (!this.usedAlone) {
|
||||
if (this.parentData.iconPlacement === "right") {
|
||||
style.marginRight = 0;
|
||||
}
|
||||
}
|
||||
return style;
|
||||
},
|
||||
checkboxStyle() {
|
||||
const style = {};
|
||||
if (!this.usedAlone) {
|
||||
if (this.parentData.borderBottom && this.parentData.placement === "row") {
|
||||
uni_modules_uviewPlus_libs_function_index.error("检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效");
|
||||
}
|
||||
if (this.parentData.borderBottom && this.parentData.placement === "column") {
|
||||
style.paddingBottom = "8px";
|
||||
}
|
||||
}
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(style, uni_modules_uviewPlus_libs_function_index.addStyle(this.customStyle));
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
emits: ["change"],
|
||||
methods: {
|
||||
init() {
|
||||
if (!this.usedAlone) {
|
||||
this.updateParentData();
|
||||
if (!this.parent) {
|
||||
uni_modules_uviewPlus_libs_function_index.error("u-checkbox必须搭配u-checkbox-group组件使用");
|
||||
}
|
||||
}
|
||||
const value = this.parentData.modelValue;
|
||||
if (this.checked) {
|
||||
this.isChecked = true;
|
||||
} else if (!this.usedAlone && uni_modules_uviewPlus_libs_function_test.test.array(value)) {
|
||||
this.isChecked = value.some((item) => {
|
||||
return item === this.name;
|
||||
});
|
||||
}
|
||||
},
|
||||
updateParentData() {
|
||||
this.getParentData("u-checkbox-group");
|
||||
},
|
||||
// 横向两端排列时,点击组件即可触发选中事件
|
||||
wrapperClickHandler(e) {
|
||||
if (!this.usedAlone) {
|
||||
this.parentData.iconPlacement === "right" && this.iconClickHandler(e);
|
||||
} else {
|
||||
this.iconClickHandler(e);
|
||||
}
|
||||
},
|
||||
// 点击图标
|
||||
iconClickHandler(e) {
|
||||
this.preventEvent(e);
|
||||
if (!this.elDisabled) {
|
||||
this.setRadioCheckedStatus();
|
||||
}
|
||||
},
|
||||
// 点击label
|
||||
labelClickHandler(e) {
|
||||
this.preventEvent(e);
|
||||
if (!this.elLabelDisabled && !this.elDisabled) {
|
||||
this.setRadioCheckedStatus();
|
||||
}
|
||||
},
|
||||
emitEvent() {
|
||||
this.$emit("change", this.isChecked);
|
||||
this.$nextTick(() => {
|
||||
uni_modules_uviewPlus_libs_function_index.formValidate(this, "change");
|
||||
});
|
||||
},
|
||||
// 改变组件选中状态
|
||||
// 这里的改变的依据是,更改本组件的checked值为true,同时通过父组件遍历所有u-checkbox实例
|
||||
// 将本组件外的其他u-checkbox的checked都设置为false(都被取消选中状态),因而只剩下一个为选中状态
|
||||
setRadioCheckedStatus() {
|
||||
this.isChecked = !this.isChecked;
|
||||
this.emitEvent();
|
||||
if (!this.usedAlone) {
|
||||
typeof this.parent.unCheckedOther === "function" && this.parent.unCheckedOther(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
checked() {
|
||||
this.isChecked = this.checked;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
|
||||
_easycom_u_icon2();
|
||||
}
|
||||
const _easycom_u_icon = () => "../u-icon/u-icon.js";
|
||||
if (!Math) {
|
||||
_easycom_u_icon();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.p({
|
||||
name: "checkbox-mark",
|
||||
size: $options.elIconSize,
|
||||
color: $options.elIconColor
|
||||
}),
|
||||
b: common_vendor.o((...args) => $options.iconClickHandler && $options.iconClickHandler(...args)),
|
||||
c: common_vendor.n($options.iconClasses),
|
||||
d: common_vendor.s($options.iconWrapStyle),
|
||||
e: common_vendor.t(_ctx.label),
|
||||
f: common_vendor.o((...args) => $options.labelClickHandler && $options.labelClickHandler(...args)),
|
||||
g: $options.elDisabled ? $options.elInactiveColor : $options.elLabelColor,
|
||||
h: $options.elLabelSize,
|
||||
i: $options.elLabelSize,
|
||||
j: common_vendor.s($options.checkboxStyle),
|
||||
k: common_vendor.o((...args) => $options.wrapperClickHandler && $options.wrapperClickHandler(...args)),
|
||||
l: common_vendor.n(`u-checkbox-label--${$data.parentData.iconPlacement}`),
|
||||
m: common_vendor.n($data.parentData.borderBottom && $data.parentData.placement === "column" && "u-border-bottom")
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-41713600"]]);
|
||||
wx.createComponent(Component);
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-icon": "../u-icon/u-icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view style="{{j}}" catchtap="{{k}}" class="{{['u-checkbox', 'cursor-pointer', 'data-v-41713600', l, m]}}"><view catchtap="{{b}}" class="{{['u-checkbox__icon-wrap', 'cursor-pointer', 'data-v-41713600', c]}}" style="{{d}}"><block wx:if="{{$slots.icon}}"><slot name="icon"></slot></block><block wx:else><u-icon wx:if="{{a}}" class="u-checkbox__icon-wrap__icon data-v-41713600" u-i="41713600-0" bind:__l="__l" u-p="{{a}}"/></block></view><text class="data-v-41713600" catchtap="{{f}}" style="{{'color:' + g + ';' + ('font-size:' + h) + ';' + ('line-height:' + i)}}">{{e}}</text></view>
|
||||
74
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.wxss
vendored
Normal file
74
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-checkbox/u-checkbox.wxss
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
.u-empty.data-v-41713600,
|
||||
.u-empty__wrap.data-v-41713600,
|
||||
.u-tabs.data-v-41713600,
|
||||
.u-tabs__wrapper.data-v-41713600,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-41713600,
|
||||
.u-tabs__wrapper__scroll-view.data-v-41713600,
|
||||
.u-tabs__wrapper__nav.data-v-41713600,
|
||||
.u-tabs__wrapper__nav__line.data-v-41713600 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-checkbox.data-v-41713600 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.u-checkbox-label--left.data-v-41713600 {
|
||||
flex-direction: row;
|
||||
}
|
||||
.u-checkbox-label--right.data-v-41713600 {
|
||||
flex-direction: row-reverse;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.u-checkbox__icon-wrap.data-v-41713600 {
|
||||
box-sizing: border-box;
|
||||
transition-property: border-color, background-color, color;
|
||||
transition-duration: 0.2s;
|
||||
color: #606266;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: transparent;
|
||||
text-align: center;
|
||||
margin-right: 6px;
|
||||
font-size: 6px;
|
||||
border-width: 1px;
|
||||
border-color: #c8c9cc;
|
||||
border-style: solid;
|
||||
}
|
||||
.u-checkbox__icon-wrap--circle.data-v-41713600 {
|
||||
border-radius: 100%;
|
||||
}
|
||||
.u-checkbox__icon-wrap--square.data-v-41713600 {
|
||||
border-radius: 3px;
|
||||
}
|
||||
.u-checkbox__icon-wrap--checked.data-v-41713600 {
|
||||
color: #fff;
|
||||
background-color: red;
|
||||
border-color: #2979ff;
|
||||
}
|
||||
.u-checkbox__icon-wrap--disabled.data-v-41713600 {
|
||||
background-color: #ebedf0 !important;
|
||||
}
|
||||
.u-checkbox__icon-wrap--disabled--checked.data-v-41713600 {
|
||||
color: #c8c9cc !important;
|
||||
}
|
||||
.u-checkbox__label.data-v-41713600 {
|
||||
word-wrap: break-word;
|
||||
margin-left: 5px;
|
||||
margin-right: 12px;
|
||||
color: #606266;
|
||||
font-size: 15px;
|
||||
}
|
||||
.u-checkbox__label--disabled.data-v-41713600 {
|
||||
color: #c8c9cc;
|
||||
}
|
||||
37
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/props.js
vendored
Normal file
37
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/props.js
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 倒计时总秒数
|
||||
seconds: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.code.seconds
|
||||
},
|
||||
// 尚未开始时提示
|
||||
startText: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.code.startText
|
||||
},
|
||||
// 正在倒计时中的提示
|
||||
changeText: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.code.changeText
|
||||
},
|
||||
// 倒计时结束时的提示
|
||||
endText: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.code.endText
|
||||
},
|
||||
// 是否在H5刷新或各端返回再进入时继续倒计时
|
||||
keepRunning: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.code.keepRunning
|
||||
},
|
||||
// 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
|
||||
uniqueKey: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.code.uniqueKey
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
100
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.js
vendored
Normal file
100
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.js
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_components_uCode_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 _sfc_main = {
|
||||
name: "u-code",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uCode_props.props],
|
||||
data() {
|
||||
return {
|
||||
secNum: this.seconds,
|
||||
timer: null,
|
||||
canGetCode: true
|
||||
// 是否可以执行验证码操作
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.checkKeepRunning();
|
||||
},
|
||||
watch: {
|
||||
seconds: {
|
||||
immediate: true,
|
||||
handler(n) {
|
||||
this.secNum = n;
|
||||
}
|
||||
}
|
||||
},
|
||||
emits: ["start", "end", "change"],
|
||||
methods: {
|
||||
checkKeepRunning() {
|
||||
let lastTimestamp = Number(common_vendor.index.getStorageSync(this.uniqueKey + "_$uCountDownTimestamp"));
|
||||
if (!lastTimestamp)
|
||||
return this.changeEvent(this.startText);
|
||||
let nowTimestamp = Math.floor(+/* @__PURE__ */ new Date() / 1e3);
|
||||
if (this.keepRunning && lastTimestamp && lastTimestamp > nowTimestamp) {
|
||||
this.secNum = lastTimestamp - nowTimestamp;
|
||||
common_vendor.index.removeStorageSync(this.uniqueKey + "_$uCountDownTimestamp");
|
||||
this.start();
|
||||
} else {
|
||||
this.changeEvent(this.startText);
|
||||
}
|
||||
},
|
||||
// 开始倒计时
|
||||
start() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
this.$emit("start");
|
||||
this.canGetCode = false;
|
||||
this.changeEvent(this.changeText.replace(/x|X/, this.secNum));
|
||||
this.timer = setInterval(() => {
|
||||
if (--this.secNum) {
|
||||
this.changeEvent(this.changeText.replace(/x|X/, this.secNum));
|
||||
} else {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.changeEvent(this.endText);
|
||||
this.secNum = this.seconds;
|
||||
this.$emit("end");
|
||||
this.canGetCode = true;
|
||||
}
|
||||
}, 1e3);
|
||||
this.setTimeToStorage();
|
||||
},
|
||||
// 重置,可以让用户再次获取验证码
|
||||
reset() {
|
||||
this.canGetCode = true;
|
||||
clearInterval(this.timer);
|
||||
this.secNum = this.seconds;
|
||||
this.changeEvent(this.endText);
|
||||
},
|
||||
changeEvent(text) {
|
||||
this.$emit("change", text);
|
||||
},
|
||||
// 保存时间戳,为了防止倒计时尚未结束,H5刷新或者各端的右上角返回上一页再进来
|
||||
setTimeToStorage() {
|
||||
if (!this.keepRunning || !this.timer)
|
||||
return;
|
||||
if (this.secNum > 0 && this.secNum < this.seconds) {
|
||||
let nowTimestamp = Math.floor(+/* @__PURE__ */ new Date() / 1e3);
|
||||
common_vendor.index.setStorage({
|
||||
key: this.uniqueKey + "_$uCountDownTimestamp",
|
||||
data: nowTimestamp + Number(this.secNum)
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 组件销毁的时候,清除定时器,否则定时器会继续存在,系统不会自动清除
|
||||
beforeUnmount() {
|
||||
this.setTimeToStorage();
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8783e3d0"]]);
|
||||
wx.createComponent(Component);
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="u-code data-v-8783e3d0"></view>
|
||||
16
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.wxss
vendored
Normal file
16
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-code/u-code.wxss
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
.u-empty.data-v-8783e3d0,
|
||||
.u-empty__wrap.data-v-8783e3d0,
|
||||
.u-tabs.data-v-8783e3d0,
|
||||
.u-tabs__wrapper.data-v-8783e3d0,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-8783e3d0,
|
||||
.u-tabs__wrapper__scroll-view.data-v-8783e3d0,
|
||||
.u-tabs__wrapper__nav.data-v-8783e3d0,
|
||||
.u-tabs__wrapper__nav__line.data-v-8783e3d0 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
17
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/props.js
vendored
Normal file
17
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/props.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 宫格的name
|
||||
name: {
|
||||
type: [String, Number, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.gridItem.name
|
||||
},
|
||||
// 背景颜色
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.gridItem.bgColor
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
115
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.js
vendored
Normal file
115
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.js
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_components_uGridItem_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 _sfc_main = {
|
||||
name: "u-grid-item",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uGridItem_props.props],
|
||||
data() {
|
||||
return {
|
||||
parentData: {
|
||||
col: 0,
|
||||
// 父组件划分的宫格数
|
||||
border: true
|
||||
// 是否显示边框,根据父组件决定
|
||||
},
|
||||
classes: []
|
||||
// 类名集合,用于判断是否显示右边和下边框
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
emits: ["click"],
|
||||
// 微信小程序中 options 选项
|
||||
options: {
|
||||
virtualHost: true
|
||||
//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
|
||||
},
|
||||
computed: {
|
||||
// vue下放到computed中,否则会因为延时造成闪烁
|
||||
width() {
|
||||
if (this.parentData.col > 0) {
|
||||
return 100 / Number(this.parentData.col) + "%";
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
itemStyle() {
|
||||
const style = {
|
||||
background: this.bgColor,
|
||||
width: this.width
|
||||
};
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(style, uni_modules_uviewPlus_libs_function_index.addStyle(this.customStyle));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
common_vendor.index.$on("$uGridItem", () => {
|
||||
this.gridItemClasses();
|
||||
});
|
||||
this.updateParentData();
|
||||
common_vendor.index.$emit("$uGridItem");
|
||||
this.gridItemClasses();
|
||||
},
|
||||
// 获取父组件的参数
|
||||
updateParentData() {
|
||||
this.getParentData("u-grid");
|
||||
},
|
||||
clickHandler() {
|
||||
var _a;
|
||||
let name = this.name;
|
||||
const children = (_a = this.parent) == null ? void 0 : _a.children;
|
||||
if (children && this.name === null) {
|
||||
name = children.findIndex((child) => child === this);
|
||||
}
|
||||
this.parent && this.parent.childClick(name);
|
||||
this.$emit("click", name);
|
||||
},
|
||||
async getItemWidth() {
|
||||
let width = 0;
|
||||
if (this.parent) {
|
||||
const parentWidth = await this.getParentWidth();
|
||||
width = parentWidth / Number(this.parentData.col) + "px";
|
||||
}
|
||||
this.width = width;
|
||||
},
|
||||
// 获取父元素的尺寸
|
||||
getParentWidth() {
|
||||
},
|
||||
gridItemClasses() {
|
||||
if (this.parentData.border) {
|
||||
let classes = [];
|
||||
this.parent.children.map((child, index) => {
|
||||
if (this === child) {
|
||||
const len = this.parent.children.length;
|
||||
if ((index + 1) % this.parentData.col !== 0 && index + 1 !== len) {
|
||||
classes.push("u-border-right");
|
||||
}
|
||||
const lessNum = len % this.parentData.col === 0 ? this.parentData.col : len % this.parentData.col;
|
||||
if (index < len - lessNum) {
|
||||
classes.push("u-border-bottom");
|
||||
}
|
||||
}
|
||||
});
|
||||
this.classes = classes;
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeUnmount() {
|
||||
common_vendor.index.$off("$uGridItem");
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.parentData.col > 0
|
||||
}, $data.parentData.col > 0 ? {
|
||||
b: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
|
||||
c: common_vendor.n($data.classes),
|
||||
d: common_vendor.s($options.itemStyle)
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0a78094b"]]);
|
||||
wx.createComponent(Component);
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view wx:if="{{a}}" hover-class="u-grid-item--hover-class" hover-stay-time="{{200}}" bindtap="{{b}}" class="{{['u-grid-item', 'data-v-0a78094b', c]}}" style="{{d}}"><slot/></view>
|
||||
29
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.wxss
vendored
Normal file
29
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid-item/u-grid-item.wxss
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
.u-empty.data-v-0a78094b,
|
||||
.u-empty__wrap.data-v-0a78094b,
|
||||
.u-tabs.data-v-0a78094b,
|
||||
.u-tabs__wrapper.data-v-0a78094b,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-0a78094b,
|
||||
.u-tabs__wrapper__scroll-view.data-v-0a78094b,
|
||||
.u-tabs__wrapper__nav.data-v-0a78094b,
|
||||
.u-tabs__wrapper__nav__line.data-v-0a78094b {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-grid-item.data-v-0a78094b {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
.u-grid-item--hover-class.data-v-0a78094b {
|
||||
opacity: 0.5;
|
||||
}
|
||||
22
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/props.js
vendored
Normal file
22
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/props.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 分成几列
|
||||
col: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.grid.col
|
||||
},
|
||||
// 是否显示边框
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.grid.border
|
||||
},
|
||||
// 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
|
||||
align: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.grid.align
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
72
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.js
vendored
Normal file
72
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.js
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uGrid_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 common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-grid",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uGrid_props.props],
|
||||
data() {
|
||||
return {
|
||||
index: 0,
|
||||
width: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
|
||||
parentData() {
|
||||
if (this.children.length) {
|
||||
this.children.map((child) => {
|
||||
typeof child.updateParentData == "function" && child.updateParentData();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.children = [];
|
||||
},
|
||||
computed: {
|
||||
// 计算父组件的值是否发生变化
|
||||
parentData() {
|
||||
return [this.hoverClass, this.col, this.size, this.border];
|
||||
},
|
||||
// 宫格对齐方式
|
||||
gridStyle() {
|
||||
let style = {};
|
||||
switch (this.align) {
|
||||
case "left":
|
||||
style.justifyContent = "flex-start";
|
||||
break;
|
||||
case "center":
|
||||
style.justifyContent = "center";
|
||||
break;
|
||||
case "right":
|
||||
style.justifyContent = "flex-end";
|
||||
break;
|
||||
default:
|
||||
style.justifyContent = "flex-start";
|
||||
}
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(style, uni_modules_uviewPlus_libs_function_index.addStyle(this.customStyle));
|
||||
}
|
||||
},
|
||||
emits: ["click"],
|
||||
// 防止事件执行两次
|
||||
// 20240409发现抖音小程序如果开启virtualHost会出现严重问题,几乎所有事件包括created等生命周期事件全部失效。
|
||||
options: {
|
||||
// virtualHost: true ,//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
|
||||
},
|
||||
methods: {
|
||||
// 此方法由u-grid-item触发,用于在u-grid发出事件
|
||||
childClick(name) {
|
||||
this.$emit("click", name);
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.s($options.gridStyle)
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-10b668c8"]]);
|
||||
wx.createComponent(Component);
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="u-grid data-v-10b668c8" ref="u-grid" style="{{a}}"><slot/></view>
|
||||
28
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxss
vendored
Normal file
28
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxss
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
.u-empty.data-v-10b668c8,
|
||||
.u-empty__wrap.data-v-10b668c8,
|
||||
.u-tabs.data-v-10b668c8,
|
||||
.u-tabs__wrapper.data-v-10b668c8,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-10b668c8,
|
||||
.u-tabs__wrapper__scroll-view.data-v-10b668c8,
|
||||
.u-tabs__wrapper__nav.data-v-10b668c8,
|
||||
.u-tabs__wrapper__nav__line.data-v-10b668c8 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-grid.data-v-10b668c8 {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
216
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/icons.js
vendored
Normal file
216
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/icons.js
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
"use strict";
|
||||
const icons = {
|
||||
"uicon-level": "",
|
||||
"uicon-column-line": "",
|
||||
"uicon-checkbox-mark": "",
|
||||
"uicon-folder": "",
|
||||
"uicon-movie": "",
|
||||
"uicon-star-fill": "",
|
||||
"uicon-star": "",
|
||||
"uicon-phone-fill": "",
|
||||
"uicon-phone": "",
|
||||
"uicon-apple-fill": "",
|
||||
"uicon-chrome-circle-fill": "",
|
||||
"uicon-backspace": "",
|
||||
"uicon-attach": "",
|
||||
"uicon-cut": "",
|
||||
"uicon-empty-car": "",
|
||||
"uicon-empty-coupon": "",
|
||||
"uicon-empty-address": "",
|
||||
"uicon-empty-favor": "",
|
||||
"uicon-empty-permission": "",
|
||||
"uicon-empty-news": "",
|
||||
"uicon-empty-search": "",
|
||||
"uicon-github-circle-fill": "",
|
||||
"uicon-rmb": "",
|
||||
"uicon-person-delete-fill": "",
|
||||
"uicon-reload": "",
|
||||
"uicon-order": "",
|
||||
"uicon-server-man": "",
|
||||
"uicon-search": "",
|
||||
"uicon-fingerprint": "",
|
||||
"uicon-more-dot-fill": "",
|
||||
"uicon-scan": "",
|
||||
"uicon-share-square": "",
|
||||
"uicon-map": "",
|
||||
"uicon-map-fill": "",
|
||||
"uicon-tags": "",
|
||||
"uicon-tags-fill": "",
|
||||
"uicon-bookmark-fill": "",
|
||||
"uicon-bookmark": "",
|
||||
"uicon-eye": "",
|
||||
"uicon-eye-fill": "",
|
||||
"uicon-mic": "",
|
||||
"uicon-mic-off": "",
|
||||
"uicon-calendar": "",
|
||||
"uicon-calendar-fill": "",
|
||||
"uicon-trash": "",
|
||||
"uicon-trash-fill": "",
|
||||
"uicon-play-left": "",
|
||||
"uicon-play-right": "",
|
||||
"uicon-minus": "",
|
||||
"uicon-plus": "",
|
||||
"uicon-info": "",
|
||||
"uicon-info-circle": "",
|
||||
"uicon-info-circle-fill": "",
|
||||
"uicon-question": "",
|
||||
"uicon-error": "",
|
||||
"uicon-close": "",
|
||||
"uicon-checkmark": "",
|
||||
"uicon-android-circle-fill": "",
|
||||
"uicon-android-fill": "",
|
||||
"uicon-ie": "",
|
||||
"uicon-IE-circle-fill": "",
|
||||
"uicon-google": "",
|
||||
"uicon-google-circle-fill": "",
|
||||
"uicon-setting-fill": "",
|
||||
"uicon-setting": "",
|
||||
"uicon-minus-square-fill": "",
|
||||
"uicon-plus-square-fill": "",
|
||||
"uicon-heart": "",
|
||||
"uicon-heart-fill": "",
|
||||
"uicon-camera": "",
|
||||
"uicon-camera-fill": "",
|
||||
"uicon-more-circle": "",
|
||||
"uicon-more-circle-fill": "",
|
||||
"uicon-chat": "",
|
||||
"uicon-chat-fill": "",
|
||||
"uicon-bag-fill": "",
|
||||
"uicon-bag": "",
|
||||
"uicon-error-circle-fill": "",
|
||||
"uicon-error-circle": "",
|
||||
"uicon-close-circle": "",
|
||||
"uicon-close-circle-fill": "",
|
||||
"uicon-checkmark-circle": "",
|
||||
"uicon-checkmark-circle-fill": "",
|
||||
"uicon-question-circle-fill": "",
|
||||
"uicon-question-circle": "",
|
||||
"uicon-share": "",
|
||||
"uicon-share-fill": "",
|
||||
"uicon-shopping-cart": "",
|
||||
"uicon-shopping-cart-fill": "",
|
||||
"uicon-bell": "",
|
||||
"uicon-bell-fill": "",
|
||||
"uicon-list": "",
|
||||
"uicon-list-dot": "",
|
||||
"uicon-zhihu": "",
|
||||
"uicon-zhihu-circle-fill": "",
|
||||
"uicon-zhifubao": "",
|
||||
"uicon-zhifubao-circle-fill": "",
|
||||
"uicon-weixin-circle-fill": "",
|
||||
"uicon-weixin-fill": "",
|
||||
"uicon-twitter-circle-fill": "",
|
||||
"uicon-twitter": "",
|
||||
"uicon-taobao-circle-fill": "",
|
||||
"uicon-taobao": "",
|
||||
"uicon-weibo-circle-fill": "",
|
||||
"uicon-weibo": "",
|
||||
"uicon-qq-fill": "",
|
||||
"uicon-qq-circle-fill": "",
|
||||
"uicon-moments-circel-fill": "",
|
||||
"uicon-moments": "",
|
||||
"uicon-qzone": "",
|
||||
"uicon-qzone-circle-fill": "",
|
||||
"uicon-baidu-circle-fill": "",
|
||||
"uicon-baidu": "",
|
||||
"uicon-facebook-circle-fill": "",
|
||||
"uicon-facebook": "",
|
||||
"uicon-car": "",
|
||||
"uicon-car-fill": "",
|
||||
"uicon-warning-fill": "",
|
||||
"uicon-warning": "",
|
||||
"uicon-clock-fill": "",
|
||||
"uicon-clock": "",
|
||||
"uicon-edit-pen": "",
|
||||
"uicon-edit-pen-fill": "",
|
||||
"uicon-email": "",
|
||||
"uicon-email-fill": "",
|
||||
"uicon-minus-circle": "",
|
||||
"uicon-minus-circle-fill": "",
|
||||
"uicon-plus-circle": "",
|
||||
"uicon-plus-circle-fill": "",
|
||||
"uicon-file-text": "",
|
||||
"uicon-file-text-fill": "",
|
||||
"uicon-pushpin": "",
|
||||
"uicon-pushpin-fill": "",
|
||||
"uicon-grid": "",
|
||||
"uicon-grid-fill": "",
|
||||
"uicon-play-circle": "",
|
||||
"uicon-play-circle-fill": "",
|
||||
"uicon-pause-circle-fill": "",
|
||||
"uicon-pause": "",
|
||||
"uicon-pause-circle": "",
|
||||
"uicon-eye-off": "",
|
||||
"uicon-eye-off-outline": "",
|
||||
"uicon-gift-fill": "",
|
||||
"uicon-gift": "",
|
||||
"uicon-rmb-circle-fill": "",
|
||||
"uicon-rmb-circle": "",
|
||||
"uicon-kefu-ermai": "",
|
||||
"uicon-server-fill": "",
|
||||
"uicon-coupon-fill": "",
|
||||
"uicon-coupon": "",
|
||||
"uicon-integral": "",
|
||||
"uicon-integral-fill": "",
|
||||
"uicon-home-fill": "",
|
||||
"uicon-home": "",
|
||||
"uicon-hourglass-half-fill": "",
|
||||
"uicon-hourglass": "",
|
||||
"uicon-account": "",
|
||||
"uicon-plus-people-fill": "",
|
||||
"uicon-minus-people-fill": "",
|
||||
"uicon-account-fill": "",
|
||||
"uicon-thumb-down-fill": "",
|
||||
"uicon-thumb-down": "",
|
||||
"uicon-thumb-up": "",
|
||||
"uicon-thumb-up-fill": "",
|
||||
"uicon-lock-fill": "",
|
||||
"uicon-lock-open": "",
|
||||
"uicon-lock-opened-fill": "",
|
||||
"uicon-lock": "",
|
||||
"uicon-red-packet-fill": "",
|
||||
"uicon-photo-fill": "",
|
||||
"uicon-photo": "",
|
||||
"uicon-volume-off-fill": "",
|
||||
"uicon-volume-off": "",
|
||||
"uicon-volume-fill": "",
|
||||
"uicon-volume": "",
|
||||
"uicon-red-packet": "",
|
||||
"uicon-download": "",
|
||||
"uicon-arrow-up-fill": "",
|
||||
"uicon-arrow-down-fill": "",
|
||||
"uicon-play-left-fill": "",
|
||||
"uicon-play-right-fill": "",
|
||||
"uicon-rewind-left-fill": "",
|
||||
"uicon-rewind-right-fill": "",
|
||||
"uicon-arrow-downward": "",
|
||||
"uicon-arrow-leftward": "",
|
||||
"uicon-arrow-rightward": "",
|
||||
"uicon-arrow-upward": "",
|
||||
"uicon-arrow-down": "",
|
||||
"uicon-arrow-right": "",
|
||||
"uicon-arrow-left": "",
|
||||
"uicon-arrow-up": "",
|
||||
"uicon-skip-back-left": "",
|
||||
"uicon-skip-forward-right": "",
|
||||
"uicon-rewind-right": "",
|
||||
"uicon-rewind-left": "",
|
||||
"uicon-arrow-right-double": "",
|
||||
"uicon-arrow-left-double": "",
|
||||
"uicon-wifi-off": "",
|
||||
"uicon-wifi": "",
|
||||
"uicon-empty-data": "",
|
||||
"uicon-empty-history": "",
|
||||
"uicon-empty-list": "",
|
||||
"uicon-empty-page": "",
|
||||
"uicon-empty-order": "",
|
||||
"uicon-man": "",
|
||||
"uicon-woman": "",
|
||||
"uicon-man-add": "",
|
||||
"uicon-man-add-fill": "",
|
||||
"uicon-man-delete": "",
|
||||
"uicon-man-delete-fill": "",
|
||||
"uicon-zh": "",
|
||||
"uicon-en": ""
|
||||
};
|
||||
exports.icons = icons;
|
||||
92
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/props.js
vendored
Normal file
92
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/props.js
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 图标类名
|
||||
name: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.name
|
||||
},
|
||||
// 图标颜色,可接受主题色
|
||||
color: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.color
|
||||
},
|
||||
// 字体大小,单位px
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.size
|
||||
},
|
||||
// 是否显示粗体
|
||||
bold: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.bold
|
||||
},
|
||||
// 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
|
||||
index: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.index
|
||||
},
|
||||
// 触摸图标时的类名
|
||||
hoverClass: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.hoverClass
|
||||
},
|
||||
// 自定义扩展前缀,方便用户扩展自己的图标库
|
||||
customPrefix: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.customPrefix
|
||||
},
|
||||
// 图标右边或者下面的文字
|
||||
label: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.label
|
||||
},
|
||||
// label的位置,只能右边或者下边
|
||||
labelPos: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.labelPos
|
||||
},
|
||||
// label的大小
|
||||
labelSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.labelSize
|
||||
},
|
||||
// label的颜色
|
||||
labelColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.labelColor
|
||||
},
|
||||
// label与图标的距离
|
||||
space: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.space
|
||||
},
|
||||
// 图片的mode
|
||||
imgMode: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.imgMode
|
||||
},
|
||||
// 用于显示图片小图标时,图片的宽度
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.width
|
||||
},
|
||||
// 用于显示图片小图标时,图片的高度
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.height
|
||||
},
|
||||
// 用于解决某些情况下,让图标垂直居中的用途
|
||||
top: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.top
|
||||
},
|
||||
// 是否阻止事件传播
|
||||
stop: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.icon.stop
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
97
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.js
vendored
Normal file
97
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.js
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uIcon_icons = require("./icons.js");
|
||||
const uni_modules_uviewPlus_components_uIcon_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_config_config = require("../../libs/config/config.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-icon",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
emits: ["click"],
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uIcon_props.props],
|
||||
computed: {
|
||||
uClasses() {
|
||||
let classes = [];
|
||||
classes.push(this.customPrefix + "-" + this.name);
|
||||
if (this.customPrefix == "uicon") {
|
||||
classes.push("u-iconfont");
|
||||
} else {
|
||||
classes.push(this.customPrefix);
|
||||
}
|
||||
if (this.color && uni_modules_uviewPlus_libs_config_config.config.type.includes(this.color))
|
||||
classes.push("u-icon__icon--" + this.color);
|
||||
return classes;
|
||||
},
|
||||
iconStyle() {
|
||||
let style = {};
|
||||
style = {
|
||||
fontSize: uni_modules_uviewPlus_libs_function_index.addUnit(this.size),
|
||||
lineHeight: uni_modules_uviewPlus_libs_function_index.addUnit(this.size),
|
||||
fontWeight: this.bold ? "bold" : "normal",
|
||||
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
|
||||
top: uni_modules_uviewPlus_libs_function_index.addUnit(this.top)
|
||||
};
|
||||
if (this.color && !uni_modules_uviewPlus_libs_config_config.config.type.includes(this.color))
|
||||
style.color = this.color;
|
||||
return style;
|
||||
},
|
||||
// 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
|
||||
isImg() {
|
||||
return this.name.indexOf("/") !== -1;
|
||||
},
|
||||
imgStyle() {
|
||||
let style = {};
|
||||
style.width = this.width ? uni_modules_uviewPlus_libs_function_index.addUnit(this.width) : uni_modules_uviewPlus_libs_function_index.addUnit(this.size);
|
||||
style.height = this.height ? uni_modules_uviewPlus_libs_function_index.addUnit(this.height) : uni_modules_uviewPlus_libs_function_index.addUnit(this.size);
|
||||
return style;
|
||||
},
|
||||
// 通过图标名,查找对应的图标
|
||||
icon() {
|
||||
if (this.customPrefix !== "uicon")
|
||||
return "";
|
||||
return uni_modules_uviewPlus_components_uIcon_icons.icons["uicon-" + this.name] || this.name;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
clickHandler(e) {
|
||||
this.$emit("click", this.index);
|
||||
this.stop && this.preventEvent(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $options.isImg
|
||||
}, $options.isImg ? {
|
||||
b: _ctx.name,
|
||||
c: common_vendor.s($options.imgStyle),
|
||||
d: common_vendor.s($options.addStyle(_ctx.customStyle))
|
||||
} : {
|
||||
e: common_vendor.t($options.icon),
|
||||
f: common_vendor.n($options.uClasses),
|
||||
g: common_vendor.s($options.iconStyle),
|
||||
h: common_vendor.s($options.addStyle(_ctx.customStyle)),
|
||||
i: _ctx.hoverClass
|
||||
}, {
|
||||
j: _ctx.label !== ""
|
||||
}, _ctx.label !== "" ? {
|
||||
k: common_vendor.t(_ctx.label),
|
||||
l: _ctx.labelColor,
|
||||
m: $options.addUnit(_ctx.labelSize),
|
||||
n: _ctx.labelPos == "right" ? $options.addUnit(_ctx.space) : 0,
|
||||
o: _ctx.labelPos == "bottom" ? $options.addUnit(_ctx.space) : 0,
|
||||
p: _ctx.labelPos == "left" ? $options.addUnit(_ctx.space) : 0,
|
||||
q: _ctx.labelPos == "top" ? $options.addUnit(_ctx.space) : 0
|
||||
} : {}, {
|
||||
r: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
|
||||
s: common_vendor.n("u-icon--" + _ctx.labelPos)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ac70166d"]]);
|
||||
wx.createComponent(Component);
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view bindtap="{{r}}" class="{{['u-icon', 'data-v-ac70166d', s]}}"><image wx:if="{{a}}" class="u-icon__img data-v-ac70166d" src="{{b}}" mode="{{'widthFix'}}" style="{{c + ';' + d}}"></image><text wx:else class="{{['u-icon__icon', 'data-v-ac70166d', f]}}" style="{{g + ';' + h}}" hover-class="{{i}}">{{e}}</text><text wx:if="{{j}}" class="u-icon__label data-v-ac70166d" style="{{'color:' + l + ';' + ('font-size:' + m) + ';' + ('margin-left:' + n) + ';' + ('margin-top:' + o) + ';' + ('margin-right:' + p) + ';' + ('margin-bottom:' + q)}}">{{k}}</text></view>
|
||||
69
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.wxss
vendored
Normal file
69
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-icon/u-icon.wxss
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
.u-empty.data-v-ac70166d,
|
||||
.u-empty__wrap.data-v-ac70166d,
|
||||
.u-tabs.data-v-ac70166d,
|
||||
.u-tabs__wrapper.data-v-ac70166d,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-ac70166d,
|
||||
.u-tabs__wrapper__scroll-view.data-v-ac70166d,
|
||||
.u-tabs__wrapper__nav.data-v-ac70166d,
|
||||
.u-tabs__wrapper__nav__line.data-v-ac70166d {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "uicon-iconfont";
|
||||
src: url("https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf") format("truetype");
|
||||
}
|
||||
.u-icon.data-v-ac70166d {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.u-icon--left.data-v-ac70166d {
|
||||
flex-direction: row-reverse;
|
||||
align-items: center;
|
||||
}
|
||||
.u-icon--right.data-v-ac70166d {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.u-icon--top.data-v-ac70166d {
|
||||
flex-direction: column-reverse;
|
||||
justify-content: center;
|
||||
}
|
||||
.u-icon--bottom.data-v-ac70166d {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.u-icon__icon.data-v-ac70166d {
|
||||
font-family: uicon-iconfont;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.u-icon__icon--primary.data-v-ac70166d {
|
||||
color: #3c9cff;
|
||||
}
|
||||
.u-icon__icon--success.data-v-ac70166d {
|
||||
color: #5ac725;
|
||||
}
|
||||
.u-icon__icon--error.data-v-ac70166d {
|
||||
color: #f56c6c;
|
||||
}
|
||||
.u-icon__icon--warning.data-v-ac70166d {
|
||||
color: #f9ae3d;
|
||||
}
|
||||
.u-icon__icon--info.data-v-ac70166d {
|
||||
color: #909399;
|
||||
}
|
||||
.u-icon__img.data-v-ac70166d {
|
||||
height: auto;
|
||||
will-change: transform;
|
||||
}
|
||||
.u-icon__label.data-v-ac70166d {
|
||||
line-height: 1;
|
||||
}
|
||||
189
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/props.js
vendored
Normal file
189
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/props.js
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 绑定的值
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.value
|
||||
},
|
||||
// number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数
|
||||
// idcard-身份证输入键盘,微信、支付宝、百度、QQ小程序
|
||||
// digit-带小数点的数字键盘,App的nvue页面、微信、支付宝、百度、头条、QQ小程序
|
||||
// text-文本输入键盘
|
||||
type: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.type
|
||||
},
|
||||
// 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true,
|
||||
// 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序
|
||||
fixed: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.fixed
|
||||
},
|
||||
// 是否禁用输入框
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.disabled
|
||||
},
|
||||
// 禁用状态时的背景色
|
||||
disabledColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.disabledColor
|
||||
},
|
||||
// 是否显示清除控件
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.clearable
|
||||
},
|
||||
// 是否密码类型
|
||||
password: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.password
|
||||
},
|
||||
// 最大输入长度,设置为 -1 的时候不限制最大长度
|
||||
maxlength: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.maxlength
|
||||
},
|
||||
// 输入框为空时的占位符
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.placeholder
|
||||
},
|
||||
// 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/
|
||||
placeholderClass: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.placeholderClass
|
||||
},
|
||||
// 指定placeholder的样式
|
||||
placeholderStyle: {
|
||||
type: [String, Object],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.placeholderStyle
|
||||
},
|
||||
// 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效
|
||||
showWordLimit: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.showWordLimit
|
||||
},
|
||||
// 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档
|
||||
// https://uniapp.dcloud.io/component/input
|
||||
// https://uniapp.dcloud.io/component/textarea
|
||||
confirmType: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.confirmType
|
||||
},
|
||||
// 点击键盘右下角按钮时是否保持键盘不收起,H5无效
|
||||
confirmHold: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.confirmHold
|
||||
},
|
||||
// focus时,点击页面的时候不收起键盘,微信小程序有效
|
||||
holdKeyboard: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.holdKeyboard
|
||||
},
|
||||
// 自动获取焦点
|
||||
// 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.focus
|
||||
},
|
||||
// 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效
|
||||
autoBlur: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.autoBlur
|
||||
},
|
||||
// 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效
|
||||
disableDefaultPadding: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.disableDefaultPadding
|
||||
},
|
||||
// 指定focus时光标的位置
|
||||
cursor: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.cursor
|
||||
},
|
||||
// 输入框聚焦时底部与键盘的距离
|
||||
cursorSpacing: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.cursorSpacing
|
||||
},
|
||||
// 光标起始位置,自动聚集时有效,需与selection-end搭配使用
|
||||
selectionStart: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.selectionStart
|
||||
},
|
||||
// 光标结束位置,自动聚集时有效,需与selection-start搭配使用
|
||||
selectionEnd: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.selectionEnd
|
||||
},
|
||||
// 键盘弹起时,是否自动上推页面
|
||||
adjustPosition: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.adjustPosition
|
||||
},
|
||||
// 输入框内容对齐方式,可选值为:left|center|right
|
||||
inputAlign: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.inputAlign
|
||||
},
|
||||
// 输入框字体的大小
|
||||
fontSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.fontSize
|
||||
},
|
||||
// 输入框字体颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.color
|
||||
},
|
||||
// 输入框前置图标
|
||||
prefixIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.prefixIcon
|
||||
},
|
||||
// 前置图标样式,对象或字符串
|
||||
prefixIconStyle: {
|
||||
type: [String, Object],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.prefixIconStyle
|
||||
},
|
||||
// 输入框后置图标
|
||||
suffixIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.suffixIcon
|
||||
},
|
||||
// 后置图标样式,对象或字符串
|
||||
suffixIconStyle: {
|
||||
type: [String, Object],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.suffixIconStyle
|
||||
},
|
||||
// 边框类型,surround-四周边框,bottom-底部边框,none-无边框
|
||||
border: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.border
|
||||
},
|
||||
// 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.readonly
|
||||
},
|
||||
// 输入框形状,circle-圆形,square-方形
|
||||
shape: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.shape
|
||||
},
|
||||
// 用于处理或者过滤输入框内容的方法
|
||||
formatter: {
|
||||
type: [Function, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.input.formatter
|
||||
},
|
||||
// 是否忽略组件内对文本合成系统事件的处理
|
||||
ignoreCompositionEvent: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
218
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.js
vendored
Normal file
218
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.js
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uInput_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 common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-input",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uInput_props.props],
|
||||
data() {
|
||||
return {
|
||||
// 清除操作
|
||||
clearInput: false,
|
||||
// 输入框的值
|
||||
innerValue: "",
|
||||
// 是否处于获得焦点状态
|
||||
focused: false,
|
||||
// value是否第一次变化,在watch中,由于加入immediate属性,会在第一次触发,此时不应该认为value发生了变化
|
||||
firstChange: true,
|
||||
// value绑定值的变化是由内部还是外部引起的
|
||||
changeFromInner: false,
|
||||
// 过滤处理方法
|
||||
innerFormatter: (value) => value
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
modelValue: {
|
||||
immediate: true,
|
||||
handler(newVal, oldVal) {
|
||||
this.innerValue = newVal;
|
||||
this.firstChange = false;
|
||||
this.changeFromInner = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 是否显示清除控件
|
||||
isShowClear() {
|
||||
const { clearable, readonly, focused, innerValue } = this;
|
||||
return !!clearable && !readonly && !!focused && innerValue !== "";
|
||||
},
|
||||
// 组件的类名
|
||||
inputClass() {
|
||||
let classes = [], { border, disabled, shape } = this;
|
||||
border === "surround" && (classes = classes.concat(["u-border", "u-input--radius"]));
|
||||
classes.push(`u-input--${shape}`);
|
||||
border === "bottom" && (classes = classes.concat([
|
||||
"u-border-bottom",
|
||||
"u-input--no-radius"
|
||||
]));
|
||||
return classes.join(" ");
|
||||
},
|
||||
// 组件的样式
|
||||
wrapperStyle() {
|
||||
const style = {};
|
||||
if (this.disabled) {
|
||||
style.backgroundColor = this.disabledColor;
|
||||
}
|
||||
if (this.border === "none") {
|
||||
style.padding = "0";
|
||||
} else {
|
||||
style.paddingTop = "6px";
|
||||
style.paddingBottom = "6px";
|
||||
style.paddingLeft = "9px";
|
||||
style.paddingRight = "9px";
|
||||
}
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(style, uni_modules_uviewPlus_libs_function_index.addStyle(this.customStyle));
|
||||
},
|
||||
// 输入框的样式
|
||||
inputStyle() {
|
||||
const style = {
|
||||
color: this.color,
|
||||
fontSize: uni_modules_uviewPlus_libs_function_index.addUnit(this.fontSize),
|
||||
textAlign: this.inputAlign
|
||||
};
|
||||
return style;
|
||||
}
|
||||
},
|
||||
emits: ["update:modelValue", "focus", "blur", "change", "confirm", "clear", "keyboardheightchange"],
|
||||
methods: {
|
||||
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
|
||||
setFormatter(e) {
|
||||
this.innerFormatter = e;
|
||||
},
|
||||
// 当键盘输入时,触发input事件
|
||||
onInput(e) {
|
||||
let { value = "" } = e.detail || {};
|
||||
const formatter = this.formatter || this.innerFormatter;
|
||||
const formatValue = formatter(value);
|
||||
this.innerValue = value;
|
||||
this.$nextTick(() => {
|
||||
this.innerValue = formatValue;
|
||||
this.valueChange();
|
||||
});
|
||||
},
|
||||
// 输入框失去焦点时触发
|
||||
onBlur(event) {
|
||||
this.$emit("blur", event.detail.value);
|
||||
uni_modules_uviewPlus_libs_function_index.sleep(150).then(() => {
|
||||
this.focused = false;
|
||||
});
|
||||
uni_modules_uviewPlus_libs_function_index.formValidate(this, "blur");
|
||||
},
|
||||
// 输入框聚焦时触发
|
||||
onFocus(event) {
|
||||
this.focused = true;
|
||||
this.$emit("focus");
|
||||
},
|
||||
// 点击完成按钮时触发
|
||||
onConfirm(event) {
|
||||
this.$emit("confirm", this.innerValue);
|
||||
},
|
||||
// 键盘高度发生变化的时候触发此事件
|
||||
// 兼容性:微信小程序2.7.0+、App 3.1.0+
|
||||
onkeyboardheightchange(event) {
|
||||
this.$emit("keyboardheightchange", event);
|
||||
},
|
||||
// 内容发生变化,进行处理
|
||||
valueChange() {
|
||||
if (this.clearInput) {
|
||||
this.innerValue = "";
|
||||
this.clearInput = false;
|
||||
}
|
||||
const value = this.innerValue;
|
||||
this.$nextTick(() => {
|
||||
this.$emit("update:modelValue", value);
|
||||
this.changeFromInner = true;
|
||||
this.$emit("change", value);
|
||||
uni_modules_uviewPlus_libs_function_index.formValidate(this, "change");
|
||||
});
|
||||
},
|
||||
// 点击清除控件
|
||||
onClear() {
|
||||
this.clearInput = true;
|
||||
this.innerValue = "";
|
||||
this.$nextTick(() => {
|
||||
this.valueChange();
|
||||
this.$emit("clear");
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 在安卓nvue上,事件无法冒泡
|
||||
* 在某些时间,我们希望监听u-from-item的点击事件,此时会导致点击u-form-item内的u-input后
|
||||
* 无法触发u-form-item的点击事件,这里通过手动调用u-form-item的方法进行触发
|
||||
*/
|
||||
clickHandler() {
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
|
||||
_easycom_u_icon2();
|
||||
}
|
||||
const _easycom_u_icon = () => "../u-icon/u-icon.js";
|
||||
if (!Math) {
|
||||
_easycom_u_icon();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.prefixIcon || _ctx.$slots.prefix
|
||||
}, _ctx.prefixIcon || _ctx.$slots.prefix ? {
|
||||
b: common_vendor.p({
|
||||
name: _ctx.prefixIcon,
|
||||
size: "18",
|
||||
customStyle: _ctx.prefixIconStyle
|
||||
})
|
||||
} : {}, {
|
||||
c: common_vendor.s($options.inputStyle),
|
||||
d: _ctx.type,
|
||||
e: _ctx.focus,
|
||||
f: _ctx.cursor,
|
||||
g: $data.innerValue,
|
||||
h: _ctx.autoBlur,
|
||||
i: _ctx.disabled || _ctx.readonly,
|
||||
j: _ctx.maxlength,
|
||||
k: _ctx.placeholder,
|
||||
l: _ctx.placeholderStyle,
|
||||
m: _ctx.placeholderClass,
|
||||
n: _ctx.confirmType,
|
||||
o: _ctx.confirmHold,
|
||||
p: _ctx.holdKeyboard,
|
||||
q: _ctx.cursorSpacing,
|
||||
r: _ctx.adjustPosition,
|
||||
s: _ctx.selectionEnd,
|
||||
t: _ctx.selectionStart,
|
||||
v: _ctx.password || _ctx.type === "password" || false,
|
||||
w: _ctx.ignoreCompositionEvent,
|
||||
x: common_vendor.o((...args) => $options.onInput && $options.onInput(...args)),
|
||||
y: common_vendor.o((...args) => $options.onBlur && $options.onBlur(...args)),
|
||||
z: common_vendor.o((...args) => $options.onFocus && $options.onFocus(...args)),
|
||||
A: common_vendor.o((...args) => $options.onConfirm && $options.onConfirm(...args)),
|
||||
B: common_vendor.o((...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args)),
|
||||
C: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
|
||||
D: $options.isShowClear
|
||||
}, $options.isShowClear ? {
|
||||
E: common_vendor.p({
|
||||
name: "close",
|
||||
size: "11",
|
||||
color: "#ffffff",
|
||||
customStyle: "line-height: 12px"
|
||||
}),
|
||||
F: common_vendor.o((...args) => $options.onClear && $options.onClear(...args))
|
||||
} : {}, {
|
||||
G: _ctx.suffixIcon || _ctx.$slots.suffix
|
||||
}, _ctx.suffixIcon || _ctx.$slots.suffix ? {
|
||||
H: common_vendor.p({
|
||||
name: _ctx.suffixIcon,
|
||||
size: "18",
|
||||
customStyle: _ctx.suffixIconStyle,
|
||||
imgMode: "widthFix"
|
||||
})
|
||||
} : {}, {
|
||||
I: common_vendor.n($options.inputClass),
|
||||
J: common_vendor.s($options.wrapperStyle)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-df79975b"]]);
|
||||
wx.createComponent(Component);
|
||||
6
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-icon": "../u-icon/u-icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['u-input', 'data-v-df79975b', I]}}" style="{{J}}"><view class="u-input__content data-v-df79975b"><view wx:if="{{a}}" class="u-input__content__prefix-icon data-v-df79975b"><block wx:if="{{$slots.prefix}}"><slot name="prefix"></slot></block><block wx:else><u-icon wx:if="{{b}}" class="data-v-df79975b" u-i="df79975b-0" bind:__l="__l" u-p="{{b}}"></u-icon></block></view><view class="u-input__content__field-wrapper data-v-df79975b" bindtap="{{C}}"><block wx:if="{{r0}}"><input class="u-input__content__field-wrapper__field data-v-df79975b" style="{{c}}" type="{{d}}" focus="{{e}}" cursor="{{f}}" value="{{g}}" auto-blur="{{h}}" disabled="{{i}}" maxlength="{{j}}" placeholder="{{k}}" placeholder-style="{{l}}" placeholder-class="{{m}}" confirm-type="{{n}}" confirm-hold="{{o}}" hold-keyboard="{{p}}" cursor-spacing="{{q}}" adjust-position="{{r}}" selection-end="{{s}}" selection-start="{{t}}" password="{{v}}" ignoreCompositionEvent="{{w}}" bindinput="{{x}}" bindblur="{{y}}" bindfocus="{{z}}" bindconfirm="{{A}}" bindkeyboardheightchange="{{B}}"/></block></view><view wx:if="{{D}}" class="u-input__content__clear data-v-df79975b" bindtap="{{F}}"><u-icon wx:if="{{E}}" class="data-v-df79975b" u-i="df79975b-1" bind:__l="__l" u-p="{{E}}"></u-icon></view><view wx:if="{{G}}" class="u-input__content__subfix-icon data-v-df79975b"><block wx:if="{{$slots.suffix}}"><slot name="suffix"></slot></block><block wx:else><u-icon wx:if="{{H}}" class="data-v-df79975b" u-i="df79975b-2" bind:__l="__l" u-p="{{H}}"></u-icon></block></view></view></view>
|
||||
72
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.wxss
vendored
Normal file
72
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-input/u-input.wxss
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
.u-empty.data-v-df79975b,
|
||||
.u-empty__wrap.data-v-df79975b,
|
||||
.u-tabs.data-v-df79975b,
|
||||
.u-tabs__wrapper.data-v-df79975b,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-df79975b,
|
||||
.u-tabs__wrapper__scroll-view.data-v-df79975b,
|
||||
.u-tabs__wrapper__nav.data-v-df79975b,
|
||||
.u-tabs__wrapper__nav__line.data-v-df79975b {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-input.data-v-df79975b {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
}
|
||||
.u-input--radius.data-v-df79975b, .u-input--square.data-v-df79975b {
|
||||
border-radius: 4px;
|
||||
}
|
||||
.u-input--no-radius.data-v-df79975b {
|
||||
border-radius: 0;
|
||||
}
|
||||
.u-input--circle.data-v-df79975b {
|
||||
border-radius: 100px;
|
||||
}
|
||||
.u-input__content.data-v-df79975b {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.u-input__content__field-wrapper.data-v-df79975b {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.u-input__content__field-wrapper__field.data-v-df79975b {
|
||||
line-height: 26px;
|
||||
text-align: left;
|
||||
color: #303133;
|
||||
height: 24px;
|
||||
font-size: 15px;
|
||||
flex: 1;
|
||||
}
|
||||
.u-input__content__clear.data-v-df79975b {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 100px;
|
||||
background-color: #c6c7cb;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform: scale(0.82);
|
||||
margin-left: 4px;
|
||||
}
|
||||
.u-input__content__subfix-icon.data-v-df79975b {
|
||||
margin-left: 4px;
|
||||
}
|
||||
.u-input__content__prefix-icon.data-v-df79975b {
|
||||
margin-right: 4px;
|
||||
}
|
||||
Reference in New Issue
Block a user