feat:初始提交uni-app项目
This commit is contained in:
20
unpackage/dist/dev/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js
vendored
Normal file
20
unpackage/dist/dev/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
const en = {
|
||||
"uni-search-bar.cancel": "cancel",
|
||||
"uni-search-bar.placeholder": "Search enter content"
|
||||
};
|
||||
const zhHans = {
|
||||
"uni-search-bar.cancel": "取消",
|
||||
"uni-search-bar.placeholder": "请输入搜索内容"
|
||||
};
|
||||
const zhHant = {
|
||||
"uni-search-bar.cancel": "取消",
|
||||
"uni-search-bar.placeholder": "請輸入搜索內容"
|
||||
};
|
||||
const messages = {
|
||||
en,
|
||||
"zh-Hans": zhHans,
|
||||
"zh-Hant": zhHant
|
||||
};
|
||||
exports.messages = messages;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js.map
|
||||
199
unpackage/dist/dev/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js
vendored
Normal file
199
unpackage/dist/dev/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniSearchBar_components_uniSearchBar_i18n_index = require("./i18n/index.js");
|
||||
const {
|
||||
t
|
||||
} = common_vendor.initVueI18n(uni_modules_uniSearchBar_components_uniSearchBar_i18n_index.messages);
|
||||
const _sfc_main = {
|
||||
name: "UniSearchBar",
|
||||
emits: ["input", "update:modelValue", "clear", "cancel", "confirm", "blur", "focus"],
|
||||
props: {
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
radius: {
|
||||
type: [Number, String],
|
||||
default: 5
|
||||
},
|
||||
clearButton: {
|
||||
type: String,
|
||||
default: "auto"
|
||||
},
|
||||
cancelButton: {
|
||||
type: String,
|
||||
default: "auto"
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: "#F8F8F8"
|
||||
},
|
||||
textColor: {
|
||||
type: String,
|
||||
default: "#000000"
|
||||
},
|
||||
maxlength: {
|
||||
type: [Number, String],
|
||||
default: 100
|
||||
},
|
||||
value: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
},
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
},
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
showSync: false,
|
||||
searchVal: ""
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
cancelTextI18n() {
|
||||
return this.cancelText || t("uni-search-bar.cancel");
|
||||
},
|
||||
placeholderText() {
|
||||
return this.placeholder || t("uni-search-bar.placeholder");
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
modelValue: {
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
this.searchVal = newVal;
|
||||
if (newVal) {
|
||||
this.show = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
focus: {
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
if (this.readonly)
|
||||
return;
|
||||
this.show = true;
|
||||
this.$nextTick(() => {
|
||||
this.showSync = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
searchVal(newVal, oldVal) {
|
||||
this.$emit("input", newVal);
|
||||
this.$emit("update:modelValue", newVal);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
searchClick() {
|
||||
if (this.readonly)
|
||||
return;
|
||||
if (this.show) {
|
||||
return;
|
||||
}
|
||||
this.show = true;
|
||||
this.$nextTick(() => {
|
||||
this.showSync = true;
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
this.searchVal = "";
|
||||
this.$nextTick(() => {
|
||||
this.$emit("clear", { value: "" });
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
if (this.readonly)
|
||||
return;
|
||||
this.$emit("cancel", {
|
||||
value: this.searchVal
|
||||
});
|
||||
this.searchVal = "";
|
||||
this.show = false;
|
||||
this.showSync = false;
|
||||
common_vendor.index.hideKeyboard();
|
||||
},
|
||||
confirm() {
|
||||
common_vendor.index.hideKeyboard();
|
||||
this.$emit("confirm", {
|
||||
value: this.searchVal
|
||||
});
|
||||
},
|
||||
blur() {
|
||||
common_vendor.index.hideKeyboard();
|
||||
this.$emit("blur", {
|
||||
value: this.searchVal
|
||||
});
|
||||
},
|
||||
emitFocus(e) {
|
||||
this.$emit("focus", e.detail);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
_easycom_uni_icons2();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_icons();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
color: "#c0c4cc",
|
||||
size: "18",
|
||||
type: "search"
|
||||
}),
|
||||
b: $data.show || $data.searchVal
|
||||
}, $data.show || $data.searchVal ? {
|
||||
c: $data.showSync,
|
||||
d: $props.readonly,
|
||||
e: $options.placeholderText,
|
||||
f: $props.maxlength,
|
||||
g: $props.textColor,
|
||||
h: common_vendor.o((...args) => $options.confirm && $options.confirm(...args)),
|
||||
i: common_vendor.o((...args) => $options.blur && $options.blur(...args)),
|
||||
j: common_vendor.o((...args) => $options.emitFocus && $options.emitFocus(...args)),
|
||||
k: $data.searchVal,
|
||||
l: common_vendor.o(($event) => $data.searchVal = $event.detail.value)
|
||||
} : {
|
||||
m: common_vendor.t($props.placeholder)
|
||||
}, {
|
||||
n: $data.show && ($props.clearButton === "always" || $props.clearButton === "auto" && $data.searchVal !== "") && !$props.readonly
|
||||
}, $data.show && ($props.clearButton === "always" || $props.clearButton === "auto" && $data.searchVal !== "") && !$props.readonly ? {
|
||||
o: common_vendor.p({
|
||||
color: "#c0c4cc",
|
||||
size: "20",
|
||||
type: "clear"
|
||||
}),
|
||||
p: common_vendor.o((...args) => $options.clear && $options.clear(...args))
|
||||
} : {}, {
|
||||
q: $props.radius + "px",
|
||||
r: $props.bgColor,
|
||||
s: common_vendor.o((...args) => $options.searchClick && $options.searchClick(...args)),
|
||||
t: $props.cancelButton === "always" || $data.show && $props.cancelButton === "auto"
|
||||
}, $props.cancelButton === "always" || $data.show && $props.cancelButton === "auto" ? {
|
||||
v: common_vendor.t($options.cancelTextI18n),
|
||||
w: common_vendor.o((...args) => $options.cancel && $options.cancel(...args))
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-searchbar"><view style="{{'border-radius:' + q + ';' + ('background-color:' + r)}}" class="uni-searchbar__box" bindtap="{{s}}"><view class="uni-searchbar__box-icon-search"><block wx:if="{{$slots.searchIcon}}"><slot name="searchIcon"></slot></block><block wx:else><uni-icons wx:if="{{a}}" u-i="9d781302-0" bind:__l="__l" u-p="{{a}}"/></block></view><input wx:if="{{b}}" focus="{{c}}" disabled="{{d}}" placeholder="{{e}}" maxlength="{{f}}" class="uni-searchbar__box-search-input" confirm-type="search" type="text" style="{{'color:' + g}}" bindconfirm="{{h}}" bindblur="{{i}}" bindfocus="{{j}}" value="{{k}}" bindinput="{{l}}"/><text wx:else class="uni-searchbar__text-placeholder">{{m}}</text><view wx:if="{{n}}" class="uni-searchbar__box-icon-clear" bindtap="{{p}}"><block wx:if="{{$slots.clearIcon}}"><slot name="clearIcon"></slot></block><block wx:else><uni-icons wx:if="{{o}}" u-i="9d781302-1" bind:__l="__l" u-p="{{o}}"/></block></view></view><text wx:if="{{t}}" bindtap="{{w}}" class="uni-searchbar__cancel">{{v}}</text></view>
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-searchbar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
position: relative;
|
||||
padding: 10px;
|
||||
}
|
||||
.uni-searchbar__box {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
justify-content: left;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
padding: 5px 8px 5px 0px;
|
||||
}
|
||||
.uni-searchbar__box-icon-search {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 0 8px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #B3B3B3;
|
||||
}
|
||||
.uni-searchbar__box-search-input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
margin-left: 5px;
|
||||
margin-top: 1px;
|
||||
background-color: inherit;
|
||||
}
|
||||
.uni-searchbar__box-icon-clear {
|
||||
align-items: center;
|
||||
line-height: 24px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
.uni-searchbar__text-placeholder {
|
||||
font-size: 14px;
|
||||
color: #B3B3B3;
|
||||
margin-left: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
.uni-searchbar__cancel {
|
||||
padding-left: 10px;
|
||||
line-height: 36px;
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
}
|
||||
Reference in New Issue
Block a user