From 6313fc5c9172aa1acbd3d2ef3e9854cb22251e22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=A2=E8=B6=8A?= <552369664@qq.com>
Date: Fri, 25 Jul 2025 13:57:34 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E3=80=90=E5=95=86=E5=9F=8E=E8=A3=85?=
=?UTF-8?q?=E4=BF=AE=E3=80=91=E5=AE=8C=E5=96=84=E5=AF=BC=E8=88=AA=E6=A0=8F?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A1=86=E7=9A=84=E8=A3=85=E4=BF=AE=EF=BC=8C?=
=?UTF-8?q?=E5=90=8C=E6=97=B6=E6=B7=BB=E5=8A=A0=E6=89=AB=E4=B8=80=E6=89=AB?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sheep/components/s-block/s-block.vue | 1 -
.../components/navbar-item.vue | 5 +-
.../s-search-block/s-search-block.vue | 86 ++++++++++++++++---
3 files changed, 78 insertions(+), 14 deletions(-)
diff --git a/sheep/components/s-block/s-block.vue b/sheep/components/s-block/s-block.vue
index eb98a827..fc447866 100644
--- a/sheep/components/s-block/s-block.vue
+++ b/sheep/components/s-block/s-block.vue
@@ -18,7 +18,6 @@
});
// 组件样式
-
const elBackground = computed(() => {
if (props.styles) {
if (props.styles.bgType === 'color')
diff --git a/sheep/components/s-custom-navbar/components/navbar-item.vue b/sheep/components/s-custom-navbar/components/navbar-item.vue
index 7d299b2e..3a1dd2c4 100644
--- a/sheep/components/s-custom-navbar/components/navbar-item.vue
+++ b/sheep/components/s-custom-navbar/components/navbar-item.vue
@@ -23,10 +23,13 @@
diff --git a/sheep/components/s-search-block/s-search-block.vue b/sheep/components/s-search-block/s-search-block.vue
index 1e9c2b51..438b13de 100644
--- a/sheep/components/s-search-block/s-search-block.vue
+++ b/sheep/components/s-search-block/s-search-block.vue
@@ -12,12 +12,24 @@
]"
:class="[{ 'border-content': navbar }]"
>
-
-
-
+
+
+
{{ placeholder }}
+
+
+
{{ item }}
+ >{{ item }}
+
@@ -55,15 +67,15 @@
/**
* 基础组件 - 搜索栏
*
- * @property {String} elBackground - 输入框背景色
- * @property {String} iconColor - 图标颜色
- * @property {String} fontColor - 字体颜色
- * @property {Number} placeholder - 默认placeholder
- * @property {Number} topRadius - 组件上圆角
- * @property {Number} bottomRadius - 组件下圆角
+ * @property {String} elBackground - 输入框背景色
+ * @property {String} iconColor - 图标颜色
+ * @property {String} fontColor - 字体颜色
+ * @property {Number} placeholder - 默认placeholder
+ * @property {Number} topRadius - 组件上圆角
+ * @property {Number} bottomRadius - 组件下圆角
*
* @slot keywords - 关键字
- * @event {Function} click - 点击组件时触发
+ * @event {Function} click - 点击组件时触发
*/
import { computed, reactive } from 'vue';
@@ -107,6 +119,16 @@
type: String,
default: '这是一个搜索框',
},
+ // placeholder位置(left | center)
+ placeholderPosition: {
+ type: String,
+ default: 'left',
+ },
+ // 是否显示扫一扫图标
+ showScan: {
+ type: Boolean,
+ default: false,
+ },
radius: {
type: Number,
default: 10,
@@ -134,6 +156,41 @@
}, 100);
}
}
+
+ // TODO 后续需完善扫一扫功能
+ /**
+ * 扫一扫
+ */
+ function onScan() {
+ uni.scanCode({
+ onlyFromCamera: false,
+ sound: 'default',
+ scanType: ['qrCode', 'barCode'],
+ success: (res) => {
+ showScanResult(res.result);
+ },
+ fail: (err) => {
+ console.error(err);
+ uni.showToast({
+ title: '扫码失败',
+ icon: 'none',
+ });
+ },
+ });
+ }
+
+ /**
+ * 展示扫码结果
+ * @param text 扫码内容
+ */
+ function showScanResult(text) {
+ uni.showModal({
+ title: '扫描结果',
+ content: text,
+ showCancel: false,
+ confirmText: '知道了',
+ });
+ }