mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 15:20:25 +08:00
增加<js-page>组件
This commit is contained in:
27
web/public/js/components/common/js-page.js
Normal file
27
web/public/js/components/common/js-page.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Vue.component("js-page", {
|
||||||
|
props: ["v-max"],
|
||||||
|
data: function () {
|
||||||
|
let max = this.vMax
|
||||||
|
if (max == null) {
|
||||||
|
max = 0
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
max: max,
|
||||||
|
page: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
updateMax: function (max) {
|
||||||
|
this.max = max
|
||||||
|
},
|
||||||
|
selectPage: function(page) {
|
||||||
|
this.page = page
|
||||||
|
this.$emit("change", page)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template:`<div>
|
||||||
|
<div class="page" v-if="max > 1">
|
||||||
|
<a href="" v-for="i in max" :class="{active: i == page}" @click.prevent="selectPage(i)">{{i}}</a>
|
||||||
|
</div>
|
||||||
|
</div>`
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user