增加新模块
This commit is contained in:
+137
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../../libs/vue.js");
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
// 搜索框形状,round-圆形,square-方形
|
||||
shape: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.shape
|
||||
},
|
||||
// 搜索框背景色,默认值#f2f2f2
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.bgColor
|
||||
},
|
||||
// 占位提示文字
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.placeholder
|
||||
},
|
||||
// 是否启用清除控件
|
||||
clearabled: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.clearabled
|
||||
},
|
||||
// 是否自动聚焦
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.focus
|
||||
},
|
||||
// 是否在搜索框右侧显示取消按钮
|
||||
showAction: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.showAction
|
||||
},
|
||||
// 右边控件的样式
|
||||
actionStyle: {
|
||||
type: Object,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.actionStyle
|
||||
},
|
||||
// 取消按钮文字
|
||||
actionText: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.actionText
|
||||
},
|
||||
// 输入框内容对齐方式,可选值为 left|center|right
|
||||
inputAlign: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.inputAlign
|
||||
},
|
||||
// input输入框的样式,可以定义文字颜色,大小等,对象形式
|
||||
inputStyle: {
|
||||
type: Object,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.inputStyle
|
||||
},
|
||||
// 是否启用输入框
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.disabled
|
||||
},
|
||||
// 边框颜色
|
||||
borderColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.borderColor
|
||||
},
|
||||
// 搜索图标的颜色,默认同输入框字体颜色
|
||||
searchIconColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.searchIconColor
|
||||
},
|
||||
// 输入框字体颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.color
|
||||
},
|
||||
// placeholder的颜色
|
||||
placeholderColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.placeholderColor
|
||||
},
|
||||
// 左边输入框的图标,可以为uView图标名称或图片路径
|
||||
searchIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.searchIcon
|
||||
},
|
||||
searchIconSize: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.searchIconSize
|
||||
},
|
||||
// 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30px"、"30px 20px"等写法
|
||||
margin: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.margin
|
||||
},
|
||||
// 开启showAction时,是否在input获取焦点时才显示
|
||||
animation: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.animation
|
||||
},
|
||||
// 输入框的初始化内容
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.value
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.value
|
||||
},
|
||||
// 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档)
|
||||
maxlength: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.maxlength
|
||||
},
|
||||
// 搜索框高度,单位px
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.height
|
||||
},
|
||||
// 搜索框左侧文本
|
||||
label: {
|
||||
type: [String, Number, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.search.label
|
||||
},
|
||||
// 键盘弹起时,是否自动上推页面
|
||||
adjustPosition: {
|
||||
type: Boolean,
|
||||
default: () => true
|
||||
},
|
||||
// 键盘收起时,是否自动失去焦点
|
||||
autoBlur: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-search/props.js.map
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
const Search = {
|
||||
// search
|
||||
search: {
|
||||
shape: "round",
|
||||
bgColor: "#f2f2f2",
|
||||
placeholder: "请输入关键字",
|
||||
clearabled: true,
|
||||
focus: false,
|
||||
showAction: true,
|
||||
actionStyle: {},
|
||||
actionText: "搜索",
|
||||
inputAlign: "left",
|
||||
inputStyle: {},
|
||||
disabled: false,
|
||||
borderColor: "transparent",
|
||||
searchIconColor: "#909399",
|
||||
searchIconSize: 22,
|
||||
color: "#606266",
|
||||
placeholderColor: "#909399",
|
||||
searchIcon: "search",
|
||||
margin: "0",
|
||||
animation: false,
|
||||
value: "",
|
||||
maxlength: "-1",
|
||||
height: 32,
|
||||
label: null
|
||||
}
|
||||
};
|
||||
exports.Search = Search;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-search/search.js.map
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_components_uSearch_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-search",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uSearch_props.props],
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
showClear: false,
|
||||
// 是否显示右边的清除图标
|
||||
show: false,
|
||||
// 标记input当前状态是否处于聚焦中,如果是,才会显示右侧的清除控件
|
||||
focused: this.focus
|
||||
// 绑定输入框的值
|
||||
// inputValue: this.value
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
keyword(nVal) {
|
||||
this.$emit("update:modelValue", nVal);
|
||||
this.$emit("change", nVal);
|
||||
},
|
||||
modelValue: {
|
||||
immediate: true,
|
||||
handler(nVal) {
|
||||
this.keyword = nVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showActionBtn() {
|
||||
return !this.animation && this.showAction;
|
||||
}
|
||||
},
|
||||
emits: ["clear", "search", "custom", "focus", "blur", "click", "clickIcon", "update:modelValue", "change"],
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
// 目前HX2.6.9 v-model双向绑定无效,故监听input事件获取输入框内容的变化
|
||||
inputChange(e) {
|
||||
this.keyword = e.detail.value;
|
||||
},
|
||||
// 清空输入
|
||||
// 也可以作为用户通过this.$refs形式调用清空输入框内容
|
||||
clear() {
|
||||
this.keyword = "";
|
||||
this.$nextTick(() => {
|
||||
this.$emit("clear");
|
||||
});
|
||||
},
|
||||
// 确定搜索
|
||||
search(e) {
|
||||
this.$emit("search", e.detail.value);
|
||||
try {
|
||||
common_vendor.index.hideKeyboard();
|
||||
} catch (e2) {
|
||||
}
|
||||
},
|
||||
// 点击右边自定义按钮的事件
|
||||
custom() {
|
||||
this.$emit("custom", this.keyword);
|
||||
try {
|
||||
common_vendor.index.hideKeyboard();
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
// 获取焦点
|
||||
getFocus() {
|
||||
this.focused = true;
|
||||
if (this.animation && this.showAction)
|
||||
this.show = true;
|
||||
this.$emit("focus", this.keyword);
|
||||
},
|
||||
// 失去焦点
|
||||
blur() {
|
||||
setTimeout(() => {
|
||||
this.focused = false;
|
||||
}, 100);
|
||||
this.show = false;
|
||||
this.$emit("blur", this.keyword);
|
||||
},
|
||||
// 点击搜索框,只有disabled=true时才发出事件,因为禁止了输入,意味着是想跳转真正的搜索页
|
||||
clickHandler() {
|
||||
if (this.disabled)
|
||||
this.$emit("click");
|
||||
},
|
||||
// 点击左边图标
|
||||
clickIcon(e) {
|
||||
this.$emit("clickIcon", this.keyword);
|
||||
try {
|
||||
common_vendor.index.hideKeyboard();
|
||||
} catch (e2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
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.$slots.label || _ctx.label !== null
|
||||
}, _ctx.$slots.label || _ctx.label !== null ? {
|
||||
b: common_vendor.t(_ctx.label)
|
||||
} : {}, {
|
||||
c: common_vendor.o($options.clickIcon),
|
||||
d: common_vendor.p({
|
||||
size: _ctx.searchIconSize,
|
||||
name: _ctx.searchIcon,
|
||||
color: _ctx.searchIconColor ? _ctx.searchIconColor : _ctx.color
|
||||
}),
|
||||
e: common_vendor.o((...args) => $options.blur && $options.blur(...args)),
|
||||
f: $data.keyword,
|
||||
g: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
h: common_vendor.o((...args) => $options.inputChange && $options.inputChange(...args)),
|
||||
i: _ctx.disabled,
|
||||
j: common_vendor.o((...args) => $options.getFocus && $options.getFocus(...args)),
|
||||
k: _ctx.focus,
|
||||
l: _ctx.maxlength,
|
||||
m: _ctx.adjustPosition,
|
||||
n: _ctx.autoBlur,
|
||||
o: _ctx.placeholder,
|
||||
p: `color: ${_ctx.placeholderColor}`,
|
||||
q: common_vendor.s({
|
||||
pointerEvents: _ctx.disabled ? "none" : "auto",
|
||||
textAlign: _ctx.inputAlign,
|
||||
color: _ctx.color,
|
||||
backgroundColor: _ctx.bgColor,
|
||||
height: $options.addUnit(_ctx.height)
|
||||
}),
|
||||
r: common_vendor.s(_ctx.inputStyle),
|
||||
s: $data.keyword && _ctx.clearabled && $data.focused
|
||||
}, $data.keyword && _ctx.clearabled && $data.focused ? {
|
||||
t: common_vendor.p({
|
||||
name: "close",
|
||||
size: "11",
|
||||
color: "#ffffff",
|
||||
customStyle: "line-height: 12px"
|
||||
}),
|
||||
v: common_vendor.o((...args) => $options.clear && $options.clear(...args))
|
||||
} : {}, {
|
||||
w: _ctx.bgColor,
|
||||
x: _ctx.shape == "round" ? "100px" : "4px",
|
||||
y: _ctx.borderColor,
|
||||
z: common_vendor.t(_ctx.actionText),
|
||||
A: common_vendor.s(_ctx.actionStyle),
|
||||
B: common_vendor.n(($options.showActionBtn || $data.show) && "u-search__action--active"),
|
||||
C: common_vendor.o((...args) => $options.custom && $options.custom(...args)),
|
||||
D: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
|
||||
E: common_vendor.s({
|
||||
margin: _ctx.margin
|
||||
}),
|
||||
F: common_vendor.s($options.addStyle(_ctx.customStyle))
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e082a34a"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-search/u-search.js.map
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-icon": "../u-icon/u-icon"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="u-search data-v-e082a34a" bindtap="{{D}}" style="{{E + ';' + F}}"><view class="u-search__content data-v-e082a34a" style="{{'background-color:' + w + ';' + ('border-radius:' + x) + ';' + ('border-color:' + y)}}"><block wx:if="{{a}}"><block wx:if="{{$slots.label}}"><slot name="label"></slot></block><block wx:else><text class="u-search__content__label data-v-e082a34a">{{b}}</text></block></block><view class="u-search__content__icon data-v-e082a34a"><u-icon wx:if="{{d}}" class="data-v-e082a34a" bindtap="{{c}}" u-i="e082a34a-0" bind:__l="__l" u-p="{{d}}"></u-icon></view><input confirm-type="search" bindblur="{{e}}" value="{{f}}" bindconfirm="{{g}}" bindinput="{{h}}" disabled="{{i}}" bindfocus="{{j}}" focus="{{k}}" maxlength="{{l}}" adjust-position="{{m}}" auto-blur="{{n}}" placeholder-class="u-search__content__input--placeholder" placeholder="{{o}}" placeholder-style="{{p}}" class="u-search__content__input data-v-e082a34a" type="text" style="{{q + ';' + r}}"/><view wx:if="{{s}}" class="u-search__content__icon u-search__content__close data-v-e082a34a" bindtap="{{v}}"><u-icon wx:if="{{t}}" class="data-v-e082a34a" u-i="e082a34a-1" bind:__l="__l" u-p="{{t}}"></u-icon></view></view><text style="{{A}}" class="{{['u-search__action', 'data-v-e082a34a', B]}}" catchtap="{{C}}">{{z}}</text></view>
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.u-empty.data-v-e082a34a,
|
||||
.u-empty__wrap.data-v-e082a34a,
|
||||
.u-tabs.data-v-e082a34a,
|
||||
.u-tabs__wrapper.data-v-e082a34a,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-e082a34a,
|
||||
.u-tabs__wrapper__scroll-view.data-v-e082a34a,
|
||||
.u-tabs__wrapper__nav.data-v-e082a34a,
|
||||
.u-tabs__wrapper__nav__line.data-v-e082a34a,
|
||||
.up-empty.data-v-e082a34a,
|
||||
.up-empty__wrap.data-v-e082a34a,
|
||||
.up-tabs.data-v-e082a34a,
|
||||
.up-tabs__wrapper.data-v-e082a34a,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-e082a34a,
|
||||
.up-tabs__wrapper__scroll-view.data-v-e082a34a,
|
||||
.up-tabs__wrapper__nav.data-v-e082a34a,
|
||||
.up-tabs__wrapper__nav__line.data-v-e082a34a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-search.data-v-e082a34a {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
.u-search__content.data-v-e082a34a {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
border-width: 1px;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
overflow: hidden;
|
||||
}
|
||||
.u-search__content__icon.data-v-e082a34a {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.u-search__content__label.data-v-e082a34a {
|
||||
color: #303133;
|
||||
font-size: 14px;
|
||||
margin: 0 4px;
|
||||
}
|
||||
.u-search__content__close.data-v-e082a34a {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-top-left-radius: 100px;
|
||||
border-top-right-radius: 100px;
|
||||
border-bottom-left-radius: 100px;
|
||||
border-bottom-right-radius: 100px;
|
||||
background-color: #C6C7CB;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform: scale(0.82);
|
||||
}
|
||||
.u-search__content__input.data-v-e082a34a {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
margin: 0 5px;
|
||||
color: #303133;
|
||||
}
|
||||
.u-search__content__input--placeholder.data-v-e082a34a {
|
||||
color: #909193;
|
||||
}
|
||||
.u-search__action.data-v-e082a34a {
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
width: 0;
|
||||
overflow: hidden;
|
||||
transition-property: width;
|
||||
transition-duration: 0.3s;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.u-search__action--active.data-v-e082a34a {
|
||||
width: 40px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
Reference in New Issue
Block a user