Fix no results bug
This commit is contained in:
parent
b1d9fc6c9a
commit
5232dc6485
@ -294,35 +294,19 @@
|
|||||||
<script>
|
<script>
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import SearchResult from '@/components/SearchResult'
|
import SearchResult from '@/components/SearchResult'
|
||||||
// import Multiselect from 'vue-multiselect'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
// Multiselect,
|
|
||||||
SearchResult,
|
SearchResult,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
query: '',
|
query: '',
|
||||||
results: [],
|
results: [],
|
||||||
value: null,
|
|
||||||
options: ['1.16.2', '1.16.1'],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
const config = {
|
await this.onSearchChange()
|
||||||
headers: {
|
|
||||||
Accept: 'application/json',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await axios.get('https://api.modrinth.com/api/v1/mod', config)
|
|
||||||
|
|
||||||
this.results = res.data
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onSearchChange() {
|
async onSearchChange() {
|
||||||
@ -333,10 +317,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.get(
|
let url = 'https://api.modrinth.com/api/v1/mod'
|
||||||
`https://api.modrinth.com/api/v1/mod?query=${this.query}`,
|
|
||||||
config
|
if (this.query.length > 0) {
|
||||||
)
|
url += `?query=${this.query}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await axios.get(url, config)
|
||||||
|
|
||||||
this.results = res.data
|
this.results = res.data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -415,10 +402,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus {
|
&:focus,
|
||||||
|
&.filter-active {
|
||||||
background-color: var(--color-grey-1);
|
background-color: var(--color-grey-1);
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filter-active {
|
||||||
|
border-left: 4px solid var(--color-brand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user