2025/2/8第一次更新

This commit is contained in:
爱吃咸鱼小猫咪
2025-02-08 18:50:38 +08:00
commit d7af560866
26519 changed files with 5046029 additions and 0 deletions
@@ -0,0 +1,161 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "u-search",
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$10],
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: common_vendor.addStyle,
addUnit: common_vendor.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({
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-ed789780"]]);
wx.createComponent(Component);
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"u-icon": "../u-icon/u-icon"
}
}
@@ -0,0 +1 @@
<view bindtap="{{D}}" style="{{E + ';' + F + ';' + virtualHostStyle}}" class="{{['u-search', 'data-v-ed789780', virtualHostClass]}}"><view class="u-search__content data-v-ed789780" 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-ed789780">{{b}}</text></block></block><view class="u-search__content__icon data-v-ed789780"><u-icon wx:if="{{d}}" class="data-v-ed789780" virtualHostClass="data-v-ed789780" bindtap="{{c}}" u-i="ed789780-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-ed789780" type="text" style="{{q + ';' + r}}"/><view wx:if="{{s}}" class="u-search__content__icon u-search__content__close data-v-ed789780" bindtap="{{v}}"><u-icon wx:if="{{t}}" class="data-v-ed789780" virtualHostClass="data-v-ed789780" u-i="ed789780-1" bind:__l="__l" u-p="{{t}}"></u-icon></view></view><text style="{{A}}" class="{{['u-search__action', 'data-v-ed789780', B]}}" catchtap="{{C}}">{{z}}</text></view>
@@ -0,0 +1,115 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.u-empty.data-v-ed789780,
.u-empty__wrap.data-v-ed789780,
.u-tabs.data-v-ed789780,
.u-tabs__wrapper.data-v-ed789780,
.u-tabs__wrapper__scroll-view-wrapper.data-v-ed789780,
.u-tabs__wrapper__scroll-view.data-v-ed789780,
.u-tabs__wrapper__nav.data-v-ed789780,
.u-tabs__wrapper__nav__line.data-v-ed789780,
.up-empty.data-v-ed789780,
.up-empty__wrap.data-v-ed789780,
.up-tabs.data-v-ed789780,
.up-tabs__wrapper.data-v-ed789780,
.up-tabs__wrapper__scroll-view-wrapper.data-v-ed789780,
.up-tabs__wrapper__scroll-view.data-v-ed789780,
.up-tabs__wrapper__nav.data-v-ed789780,
.up-tabs__wrapper__nav__line.data-v-ed789780 {
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-ed789780 {
display: flex;
flex-direction: row;
align-items: center;
flex: 1;
}
.u-search__content.data-v-ed789780 {
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-ed789780 {
display: flex;
flex-direction: row;
align-items: center;
}
.u-search__content__label.data-v-ed789780 {
color: #303133;
font-size: 14px;
margin: 0 4px;
}
.u-search__content__close.data-v-ed789780 {
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-ed789780 {
flex: 1;
font-size: 14px;
line-height: 1;
margin: 0 5px;
color: #303133;
}
.u-search__content__input--placeholder.data-v-ed789780 {
color: #909193;
}
.u-search__action.data-v-ed789780 {
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-ed789780 {
width: 40px;
margin-left: 5px;
}