mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-16 01:41:15 +08:00
45 lines
872 B
Vue
45 lines
872 B
Vue
<template>
|
|
<li
|
|
:class="classes"
|
|
@click="handleClick"
|
|
@keyPress="handleKeyPress"
|
|
:title="showTitle ? 'page' : null">
|
|
<a>{{page}}</a>
|
|
</li>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name: 'Page',
|
|
props: {
|
|
rootPrefixCls: String,
|
|
page: Number,
|
|
active: Boolean,
|
|
showTitle: Boolean,
|
|
},
|
|
data () {
|
|
return {}
|
|
},
|
|
computed: {
|
|
classes () {
|
|
const prefixCls = `${this.rootPrefixCls}-item`
|
|
let cls = `${prefixCls} ${prefixCls}-${this.page}`
|
|
if (this.active) {
|
|
cls = `${cls} ${prefixCls}-active`
|
|
}
|
|
if (this.className) {
|
|
cls = `${cls} ${this.className}`
|
|
}
|
|
return cls
|
|
},
|
|
},
|
|
methods: {
|
|
handleClick () {
|
|
this.$emit('click', this.page)
|
|
},
|
|
handleKeyPress (event) {
|
|
this.$emit('keyPress', event, this.handleClick, this.page)
|
|
},
|
|
},
|
|
}
|
|
</script>
|