init
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<view class="flex-center ju-between w100 search">
|
||||
<view class="flex-center flex1 search_input">
|
||||
<image
|
||||
style="width: 32rpx; height: 32rpx"
|
||||
src="/static/icon/search1.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<input
|
||||
class="flex1 input"
|
||||
type="text"
|
||||
placeholder="搜索想要的商品"
|
||||
confirm-type="搜索"
|
||||
placeholder-class="search_placeholder"
|
||||
v-model="searchText"
|
||||
@confirm="search"
|
||||
/>
|
||||
<view class="search_btn" @click="search">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
const emit = defineEmits(['search']);
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
let searchText = ref('');
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
() => {
|
||||
searchText.value = props.modelValue;
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
// let globalData = uni.getStorageSync('globalData');
|
||||
const search = () => {
|
||||
emit('search', searchText.value);
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
// background-color: #fff;
|
||||
.search_input {
|
||||
border: 4rpx solid #fa9c31;
|
||||
height: 72rpx;
|
||||
border-radius: 64rpx;
|
||||
padding-left: 28rpx;
|
||||
padding-right: 6rpx;
|
||||
input {
|
||||
width: 100%;
|
||||
margin-left: 16rpx;
|
||||
height: 100%;
|
||||
}
|
||||
.search_btn {
|
||||
line-height: 64rpx;
|
||||
width: 108rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(270deg, #fa7931 0%, #fa9c31 100%);
|
||||
border-radius: 64rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.shopIcon {
|
||||
width: 80rpx;
|
||||
}
|
||||
.search_placeholder {
|
||||
font-size: 28rpx !important;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user