mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
Merge branch 'master' into customizable-text
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
<template>
|
||||
<v-select
|
||||
:options="paginated"
|
||||
:filterable="false"
|
||||
@search="(query) => (search = query)"
|
||||
>
|
||||
<v-select :options="paginated" :filterable="false" @search="onSearch">
|
||||
<li slot="list-footer" class="pagination">
|
||||
<button :disabled="!hasPrevPage" @click="offset -= 10">Prev</button>
|
||||
<button :disabled="!hasNextPage" @click="offset += 10">Next</button>
|
||||
<button :disabled="!hasPrevPage" @click="offset -= limit">Prev</button>
|
||||
<button :disabled="!hasNextPage" @click="offset += limit">Next</button>
|
||||
</li>
|
||||
</v-select>
|
||||
</template>
|
||||
@@ -22,24 +18,32 @@ export default {
|
||||
}),
|
||||
computed: {
|
||||
filtered() {
|
||||
return this.countries.filter((country) => country.includes(this.search))
|
||||
return this.countries.filter((country) =>
|
||||
country.toLocaleLowerCase().includes(this.search.toLocaleLowerCase())
|
||||
)
|
||||
},
|
||||
paginated() {
|
||||
return this.filtered.slice(this.offset, this.limit + this.offset)
|
||||
},
|
||||
hasNextPage() {
|
||||
const nextOffset = this.offset + 10
|
||||
const nextOffset = this.offset + this.limit
|
||||
return Boolean(
|
||||
this.filtered.slice(nextOffset, this.limit + nextOffset).length
|
||||
)
|
||||
},
|
||||
hasPrevPage() {
|
||||
const prevOffset = this.offset - 10
|
||||
const prevOffset = this.offset - this.limit
|
||||
return Boolean(
|
||||
this.filtered.slice(prevOffset, this.limit + prevOffset).length
|
||||
)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onSearch(query) {
|
||||
this.search = query
|
||||
this.offset = 0
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
+2
-2
@@ -189,7 +189,7 @@ disabled: {
|
||||
|
||||
## dropdownShouldOpen <Badge text="v3.12.0+" />
|
||||
|
||||
Determines whether the dropdown should open. Used
|
||||
Determines whether the dropdown should open. Used
|
||||
for overriding the default dropdown behaviour. Receives
|
||||
the vue-select instance as the single argument to the function.
|
||||
|
||||
@@ -250,7 +250,7 @@ if the option should be displayed.
|
||||
filterBy: {
|
||||
type: Function,
|
||||
default(option, label, search) {
|
||||
return (label || '').toLowerCase().indexOf(search.toLowerCase()) > -1
|
||||
return (label || '').toLocaleLowerCase().indexOf(search.toLocaleLowerCase()) > -1
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
+9
-9
@@ -6050,9 +6050,9 @@ path-key@^3.1.0:
|
||||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||
|
||||
path-parse@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
|
||||
path-to-regexp@0.1.7:
|
||||
version "0.1.7"
|
||||
@@ -6672,9 +6672,9 @@ querystring@0.2.0:
|
||||
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
|
||||
|
||||
querystringify@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"
|
||||
integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
|
||||
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==
|
||||
|
||||
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
|
||||
version "2.1.0"
|
||||
@@ -8217,9 +8217,9 @@ url-parse-lax@^3.0.0:
|
||||
prepend-http "^2.0.0"
|
||||
|
||||
url-parse@^1.4.3:
|
||||
version "1.4.7"
|
||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278"
|
||||
integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==
|
||||
version "1.5.3"
|
||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
|
||||
integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
|
||||
dependencies:
|
||||
querystringify "^2.1.1"
|
||||
requires-port "^1.0.0"
|
||||
|
||||
Reference in New Issue
Block a user