2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-29 05:14:04 +03:00
Files
vue-select/dev/Paginated.vue
T
2019-11-06 09:52:59 -08:00

44 lines
895 B
Vue

<template>
<v-select :options="options">
<template v-slot:option="{ option, attributes, events }">
<li v-if="option.label === 'pagination'">
<button @click="offset -= 10">Prev</button><button @click="offset += 10">Next</button>
</li>
<li v-else v-bind="attributes" v-on="events">{{ option.label }}</li>
</template>
</v-select>
</template>
<script>
import countries from '../docs/.vuepress/data/countries';
export default {
name: 'Paginated',
data: () => ({
countries,
offset: 0,
limit: 10,
}),
computed: {
options () {
return [...this.countries.slice(this.offset, this.limit + this.offset), 'pagination'];
},
},
};
</script>
<style scoped>
.pagination {
display: flex;
margin: .25rem .25rem 0;
}
.pagination button {
flex-grow: 1;
}
.pagination button:hover {
cursor: pointer;
}
</style>