消息
This commit is contained in:
122
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.js
vendored
Normal file
122
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.js
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
require("../../../adapter-vue.js");
|
||||
const common_assets = require("../../../../common/assets.js");
|
||||
const TUIKit_utils_env = require("../../../utils/env.js");
|
||||
if (!Math) {
|
||||
Icon();
|
||||
}
|
||||
const Icon = () => "../../common/Icon.js";
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "index",
|
||||
props: {
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => common_vendor.Wt.t("TUISearch.搜索")
|
||||
},
|
||||
searchType: {
|
||||
type: String,
|
||||
default: "global",
|
||||
// "global" / "conversation"
|
||||
validator(value) {
|
||||
return ["global", "conversation"].includes(value);
|
||||
}
|
||||
}
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const searchValueModel = common_vendor.ref("");
|
||||
const currentSearchInputValue = common_vendor.ref("");
|
||||
const searchingStatus = common_vendor.ref(false);
|
||||
function onCurrentSearchInputValueChange(obj) {
|
||||
if ((obj == null ? void 0 : obj.searchType) === (props == null ? void 0 : props.searchType)) {
|
||||
currentSearchInputValue.value = obj == null ? void 0 : obj.value;
|
||||
searchValueModel.value = obj == null ? void 0 : obj.value;
|
||||
}
|
||||
}
|
||||
function onCurrentSearchingStatusChange(obj) {
|
||||
if ((obj == null ? void 0 : obj.searchType) === (props == null ? void 0 : props.searchType)) {
|
||||
searchingStatus.value = obj == null ? void 0 : obj.isSearching;
|
||||
}
|
||||
}
|
||||
common_vendor.onMounted(() => {
|
||||
common_vendor.Jt.watch(common_vendor.o.SEARCH, {
|
||||
currentSearchInputValue: onCurrentSearchInputValueChange,
|
||||
currentSearchingStatus: onCurrentSearchingStatusChange
|
||||
});
|
||||
});
|
||||
common_vendor.onUnmounted(() => {
|
||||
common_vendor.Jt.unwatch(common_vendor.o.SEARCH, {
|
||||
currentSearchInputValue: onCurrentSearchInputValueChange,
|
||||
currentSearchingStatus: onCurrentSearchingStatusChange
|
||||
});
|
||||
});
|
||||
const search = () => {
|
||||
if (searchValueModel.value === currentSearchInputValue.value) {
|
||||
return;
|
||||
}
|
||||
common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchInputValue", {
|
||||
value: searchValueModel.value,
|
||||
searchType: props.searchType
|
||||
});
|
||||
};
|
||||
const endSearching = () => {
|
||||
searchingStatus.value = false;
|
||||
common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchingStatus", {
|
||||
isSearching: false,
|
||||
searchType: props.searchType
|
||||
});
|
||||
common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchInputValue", {
|
||||
value: "",
|
||||
searchType: props.searchType
|
||||
});
|
||||
};
|
||||
const onSearchInputClick = () => {
|
||||
common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchingStatus", {
|
||||
isSearching: true,
|
||||
searchType: props.searchType
|
||||
});
|
||||
};
|
||||
const onBlur = () => {
|
||||
var _a, _b;
|
||||
(_b = (_a = common_vendor.i) == null ? void 0 : _a.hideKeyboard) == null ? void 0 : _b.call(_a);
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
file: common_vendor.unref(common_assets.searchIcon),
|
||||
width: "14px",
|
||||
height: "14px"
|
||||
}),
|
||||
b: props.placeholder,
|
||||
c: common_vendor.o$1(onBlur),
|
||||
d: common_vendor.o$1(search),
|
||||
e: common_vendor.o$1(search),
|
||||
f: common_vendor.o$1(onSearchInputClick),
|
||||
g: common_vendor.unref(searchValueModel),
|
||||
h: common_vendor.o$1(($event) => common_vendor.isRef(searchValueModel) ? searchValueModel.value = $event.detail.value : null),
|
||||
i: common_vendor.unref(searchingStatus)
|
||||
}, common_vendor.unref(searchingStatus) ? {
|
||||
j: common_vendor.p({
|
||||
file: common_vendor.unref(common_assets.closeIcon),
|
||||
width: "14px",
|
||||
height: "14px"
|
||||
}),
|
||||
k: common_vendor.o$1(endSearching)
|
||||
} : {}, {
|
||||
l: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-input-h5"),
|
||||
m: !common_vendor.unref(TUIKit_utils_env.isPC) && common_vendor.unref(searchingStatus) && props.searchType === "global"
|
||||
}, !common_vendor.unref(TUIKit_utils_env.isPC) && common_vendor.unref(searchingStatus) && props.searchType === "global" ? {
|
||||
n: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUISearch.取消")),
|
||||
o: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-input-h5-cancel"),
|
||||
p: common_vendor.o$1(endSearching)
|
||||
} : {}, {
|
||||
q: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-input-container-h5"),
|
||||
r: common_vendor.n(props.searchType === "global" ? "tui-search-input-container-global" : "tui-search-input-container-conversation")
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9c7789a6"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUISearch/search-input/index.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"icon": "../../common/Icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-9c7789a6', 'tui-search-input-container', q, r]}}"><view class="{{['data-v-9c7789a6', 'tui-search-input', l]}}"><view class="tui-search-input-left data-v-9c7789a6"><icon wx:if="{{a}}" class="icon data-v-9c7789a6" u-i="9c7789a6-0" bind:__l="__l" u-p="{{a}}"/></view><input class="tui-search-input-main data-v-9c7789a6" type="text" placeholder="{{b}}" focus="{{false}}" enterkeyhint="search" bindblur="{{c}}" bindkeyup="{{d}}" bindconfirm="{{e}}" catchtap="{{f}}" value="{{g}}" bindinput="{{h}}"></input><view wx:if="{{i}}" class="tui-search-input-right data-v-9c7789a6" bindtap="{{k}}"><icon wx:if="{{j}}" class="icon data-v-9c7789a6" u-i="9c7789a6-1" bind:__l="__l" u-p="{{j}}"/></view></view><view wx:if="{{m}}" class="{{['data-v-9c7789a6', 'tui-search-input-cancel', o]}}" bindtap="{{p}}">{{n}}</view></view>
|
||||
83
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.wxss
vendored
Normal file
83
unpackage/dist/dev/mp-weixin/TUIKit/components/TUISearch/search-input/index.wxss
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.tui-search-input-container.data-v-9c7789a6 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.tui-search-input-container-global.data-v-9c7789a6 {
|
||||
flex: 1;
|
||||
}
|
||||
.tui-search-input-container .tui-search-input.data-v-9c7789a6 {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: calc(100% - 20px);
|
||||
margin: 10px;
|
||||
background: #ededed;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.tui-search-input-container .tui-search-input-main.data-v-9c7789a6 {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
border: none;
|
||||
caret-color: #007aff;
|
||||
font-size: 14px;
|
||||
}
|
||||
.tui-search-input-container .tui-search-input-main.data-v-9c7789a6:focus {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
.tui-search-input-container .tui-search-input-main.data-v-9c7789a6::-webkit-input-placeholder {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
.tui-search-input-container .tui-search-input-main.data-v-9c7789a6::placeholder {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
.tui-search-input-container .tui-search-input-left.data-v-9c7789a6, .tui-search-input-container .tui-search-input-right.data-v-9c7789a6 {
|
||||
display: flex;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
padding: 0 7px;
|
||||
}
|
||||
.tui-search-input-container-h5 .tui-search-input-h5.data-v-9c7789a6 {
|
||||
height: 34px;
|
||||
}
|
||||
.tui-search-input-container-h5 .tui-search-input-cancel.data-v-9c7789a6 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #007aff;
|
||||
font-size: 16px;
|
||||
padding: 7px 10px 7px 3px;
|
||||
font-family: "PingFang SC", sans-serif;
|
||||
}
|
||||
Reference in New Issue
Block a user