diff --git a/sheep/components/s-block/s-block.vue b/sheep/components/s-block/s-block.vue index 152b8a67..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') @@ -26,7 +25,7 @@ if (props.styles.bgType === 'img') return { background: `url(${sheep.$url.cdn( - props.styles.bgImage, + props.styles.bgImg, )}) no-repeat top center / 100% auto`, }; } 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: '知道了', + }); + }