File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<img alt =" Vue logo" src =" ./assets/logo.png" />
3
- <HelloWorld msg = " Hello Vue 3.0 + Vite " />
3
+ <HelloWorld />
4
4
</template >
5
5
6
6
<script >
@@ -13,3 +13,9 @@ export default {
13
13
}
14
14
}
15
15
</script >
16
+
17
+ <style scoped>
18
+ img {
19
+ width : 5em ;
20
+ }
21
+ </style >
Original file line number Diff line number Diff line change 6
6
placeholder =' Filter Search'
7
7
v-model =' query'
8
8
/>
9
- <search-results :query =' query' />
9
+ <br >
10
+ <button @click =' reset' > Reset </button >
11
+ <search-results :query =' query' />
10
12
</div >
11
13
</template >
12
14
20
22
setup () {
21
23
const query = ref (' ' )
22
24
25
+ const reset = (evt ) => {
26
+ query .value = ' ' // clears the query
27
+ }
28
+
23
29
return {
30
+ reset,
24
31
query
25
32
}
26
33
}
Original file line number Diff line number Diff line change 9
9
</div >
10
10
</template >
11
11
<script >
12
- import { ref , computed , onMounted } from ' vue'
12
+ import { computed , onMounted } from ' vue'
13
13
import titles from ' ../post-data.json'
14
14
export default {
15
15
props: {
@@ -20,7 +20,7 @@ export default {
20
20
onMounted (() => {
21
21
console .log (' mounted' )
22
22
})
23
-
23
+
24
24
const filteredTitles = computed (() => {
25
25
return titles .filter (s => s .Name .toLowerCase ().includes (props .query .toLowerCase ()))
26
26
})
You can’t perform that action at this time.
0 commit comments