vuikit
Version:
A Vuejs component library based on UIkit
37 lines (31 loc) • 869 B
JavaScript
/**
* Vuikit 0.7.0
* (c) 2018 Miljan Aleksic
* @license MIT
*/
import { isInteger } from 'vuikit/core/util'
export default {
functional: true,
render: (h, { parent }) => {
// if not rendered by VkPagination, return comment to mark the position
if (!(parent.$options && parent.$options._componentTag === 'vk-pagination')) {
return h('li', 'pages')
}
const { page: currentPage } = parent
return parent.pages.map(page => {
const isPage = isInteger(page)
const isActive = isPage && currentPage === page
return h('li', { class: { 'uk-active': isActive } }, [
isPage
? isActive
? h('span', page)
: h('a', {
on: { click: e => {
parent.$emit('update:page', page)
}}
}, page)
: h('span', '...')
])
})
}
}