kitchendDevice/components/search2.vue

75 lines
1.1 KiB
Vue
Raw Normal View History

2025-07-28 16:57:16 +08:00
<template>
<!-- 搜索 -->
2025-11-08 16:50:26 +08:00
<view class="search" @click="handleSearch">
<input type="text" :placeholder="name" />
2025-11-25 14:21:22 +08:00
<icon v-if="name" class="iconfont icon-error" @click="handleSearch"></icon>
2025-11-08 16:50:26 +08:00
<image src="/static/28.png"></image>
2025-07-28 16:57:16 +08:00
</view>
</template>
<script>
export default {
name: "search",
data() {
2025-11-08 16:50:26 +08:00
return {};
},
props: {
name: {
type: String,
default: ''
}
2025-07-28 16:57:16 +08:00
},
methods: {
// 搜索
handleSearch() {
2025-11-08 16:50:26 +08:00
uni.switchTab({
url: '/pages/search/search'
2025-07-28 16:57:16 +08:00
})
},
}
}
</script>
<style scoped lang="scss">
2025-11-08 16:50:26 +08:00
.search {
width: 100%;
position: fixed;
left: 0;
top: 0;
padding-bottom: 35px;
2025-11-25 14:21:22 +08:00
padding-top: 20rpx;
2025-11-08 16:50:26 +08:00
background-color: $maincolor;
input {
2025-11-25 14:21:22 +08:00
width: calc(100% - 80rpx);
2025-11-08 16:50:26 +08:00
background: #fff;
height: 39px;
line-height: 38px;
2025-11-25 14:21:22 +08:00
border-radius: 20rpx;
padding: 0 20rpx;
margin: 0 20rpx;
2025-11-08 16:50:26 +08:00
}
.input:hover {
box-shadow: 0 1rpx 20rpx #ccc;
}
image {
2025-11-25 14:21:22 +08:00
width: 50rpx;
height: 50rpx;
2025-11-08 16:50:26 +08:00
position: absolute;
2025-11-25 14:21:22 +08:00
right: 40rpx;
2025-11-08 16:50:26 +08:00
top: 18px;
z-index: 99;
}
2025-07-28 16:57:16 +08:00
}
2025-11-25 14:21:22 +08:00
.icon-error {
color: #888484;
position: absolute;
right: 120rpx;
top: 18px;
font-size: 24px;
}
2025-11-08 16:50:26 +08:00
</style>