search.vue
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<template>
<view>
<div class="searchDiv">
<image src="../../static/list/searchIcon.png" mode="widthFix" :class="{'focusClass':isFocus}"></image>
<input type="text" v-model="searchVal" placeholder="输入名称" placeholder-class="centers" confirm-type='搜索' @focus="inputFocus" @blur="inputBlur" @input="itemChange">
</div>
<!-- <div style="position: relative;">
<slot></slot>
<div class="toast" v-show="toastShow">
<div class="toastContent">
<div class="arrow"></div>
<span class="typeBox" v-for="item in typeArr" @tap="itemClick(item.key)">{{item.name}}</span>
</div>
</div>
</div>
<div class="dialog" v-if="toastShow" @tap="$emit('update:toastShow', false)"></div> -->
</view>
</template>
<script>
export default{
data() {
return {
isFocus:false,
searchVal:''
}
},
props: {
},
watch: {
},
methods: {
itemChange() {
setTimeout(()=>{
this.$emit('handleEvent',this.searchVal);
console.log('aaaa',this.searchVal)
},300)
},
inputFocus(){
this.isFocus=true
},
inputBlur(){
if(this.searchVal==''){
this.isFocus=false
}
}
},
}
</script>
<style>
.searchDiv{
padding: 12.68upx 23.55upx;
background: #f4f4f5;
position: relative;
}
.searchDiv input{
height: 54.34upx;
background: #fff;
padding:0 45.28upx;
}
.searchDiv image{
width: 25.37upx;
position: absolute;
top: 25.37upx;
z-index: 9;
left: 297.1upx;
}
.searchDiv .focusClass{
left: 32.6upx;
transition: all .3s;
}
</style>