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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
<div class="search-box" :style="{ width }">
<el-input
placeholder="输入关键词查询"
:value="value"
@keyup.native.enter="handleSearch"
@input="changeInput"
>
<i
v-show="value"
slot="suffix"
class="el-icon-circle-close"
@click="handleClose"
></i>
</el-input>
<el-button class="search-btn" @click="handleSearch">
<span class="flex aic jcc">
<img class="mr10" src="../assets/img/sousuo.png" /> 搜索
</span>
</el-button>
</div>
</template>
<script>
export default {
model: {
prop: "value",
event: "input",
},
props: {
width: {
type: String,
default: "600px",
},
value: {
type: String,
Number,
default: "",
},
},
data() {
return {};
},
methods: {
changeInput(val) {
this.$emit("input", val);
},
handleSearch() {
this.$emit("click");
},
handleClose() {
this.$emit("clear");
this.$emit("input", "");
},
},
};
</script>
<style lang="less" scoped>
.search-box {
box-shadow: 0px 7px 13px 0px rgba(0, 0, 0, 0.1);
border-radius: 8px;
position: relative;
}
.search-btn {
width: 167px;
height: 62px;
background: linear-gradient(
90deg,
var(--main-theme-color),
var(--main-assist-color)
);
border-radius: 8px;
color: #ffffff;
font-size: 24px;
border: none;
position: absolute;
right: 5px;
top: 5px;
}
:deep(.el-input__suffix) {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: 200px;
}
.el-icon-circle-close {
font-size: 30px;
}
:deep(.el-input__inner) {
height: 72px;
padding-right: 240px;
font-size: 24px;
border-radius: 8px;
color: #333;
&:hover {
border-color: var(--main-theme-color);
}
&:focus {
border-color: var(--main-theme-color);
}
}
</style>