You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.6 KiB

3 years ago
<template>
<view>
<view class="searchGood">
<view class="search acea-row row-between-wrapper">
3 years ago
<view class="input acea-row row-between-wrapper" @click="submit">
3 years ago
<!-- <text class="iconfont icon-sousuo2"></text> -->
3 years ago
<!-- <form @submit.prevent="submit"></form> -->
3 years ago
<input type="text" placeholder="大家都在搜APP开发" v-model="search" />
3 years ago
<view class="bnt">搜索</view>
3 years ago
</view>
3 years ago
3 years ago
</view>
<view v-if="keywords.length">
<view class="title">热门搜索</view>
<view class="list acea-row">
<view
class="item"
v-for="keywordsKey of keywords"
:key="keywordsKey"
@click="toSearch(keywordsKey)"
>{{ keywordsKey }}</view>
</view>
</view>
<view class="line"></view>
<!-- <GoodList></GoodList>-->
</view>
<!--<view class="noCommodity">-->
<!--<view class="noPictrue">-->
<!--<image :src="`${$VUE_APP_RESOURCES_URL}/images/noSearch.png`" class="image" />-->
<!--</view>-->
<!--<recommend></recommend>-->
<!--</view>-->
</view>
</template>
<script>
// import GoodList from "@/components/GoodList";
import { getSearchKeyword } from "@/api/store";
import { trim } from "@/utils";
// import Recommend from "@/components/Recommend";
export default {
name: "GoodSearch",
components: {
// Recommend,
// GoodList
},
props: {},
data: function() {
return {
keywords: [],
search: ""
};
},
mounted: function() {
this.getData();
},
methods: {
submit() {
3 years ago
console.log('ddaas')
3 years ago
const search = trim(this.search) || "";
3 years ago
console.log(search)
3 years ago
if (!search) return;
this.toSearch(search);
},
toSearch(s) {
3 years ago
this.$yrouter.push({ path: "/pagesB/pages/shop/GoodsList/index", query: { s } });
// uni.navigateTo({
// url: '/pagesB/pages/shop/GoodsList/index?s'
// })
3 years ago
},
getData() {
getSearchKeyword().then(res => {
this.keywords = res.data;
});
}
}
};
</script>
3 years ago
<style lang="less">
.searchGood{
.search{
padding: 0 40rpx;
.input{
width: 670rpx;
height: 68rpx;
border: 2rpx solid #FF5100;
border-radius: 8rpx;
background: rgba(255, 255, 255, 0.39);
padding: 0 0 0 20rpx;
3 years ago
input{
width: calc(100% - 150rpx);
}
3 years ago
.bnt{
width: 132rpx;
height: 68rpx;
background: linear-gradient(39deg, #FF5100 0%, #FFA074 100%);
3 years ago
border-radius:0 8rpx 8rpx 0;
3 years ago
position: absolute;
right: 40rpx;
color: #fff;
}
}
}
}
3 years ago
.noCommodity {
border-top: 0.05*100rpx solid #f5f5f5;
}
</style>