vue2 기반의 테이블 페이징 컴포넌트 구현 방법
이 글에서는 주로 vue2 기반의 테이블 페이징 구성 요소 구현 방법을 자세히 소개합니다. 관심 있는 친구들이 참고할 수 있습니다.
이 글의 예는 vue2 테이블을 모두와 공유합니다. 페이지네이션 컴포넌트의 구체적인 코드는 참고용입니다. 구체적인 내용은 다음과 같습니다
pagination.js:
(function(){ var template = '<p class="page-bar" > \ <p class="info">{{info}}</p>\ <p class="showpages">每页<select class="showpages-select" v-on:change="pageschange" v-model="selected" ><option v-for="item in showpages">{{item}}</option></select>条</p>\ <p class="pagesbtn"><ul v-on:click="setpage"> \ <li ><a v-bind:class="setButtonClass(0)" v-on:click="firstPage()">首页</a></li> \ <li><a v-bind:class="setButtonClass(0)" v-on:click="prvePage()">上一页</a></li> \ <li v-for="index in indexs" v-bind:class="{ active: cur == index }"> \ <a v-on:click="btnclick(index)" >{{ index < 1 ? "..." : index }}</a> \ </li> \ <li ><a v-bind:class="setButtonClass(1)" v-on:click="nextPage()">下一页</a></li> \ <li ><a v-bind:class="setButtonClass(1)" v-on:click="lastPage()">尾页</a></li> \ </ul></p> \ </p>\ ' var pagination = Vue.extend({ template: template, props: ["cur", "all", "selected", "showpages", "info"], computed: { indexs: function () { var left = 1 var right = this.all var ar = [] if (this.all >= 11) { if (this.cur > 5 && this.cur < this.all - 4) { left = this.cur - 5 right = this.cur + 4 } else { if (this.cur <= 5) { left = 1 right = 10 } else { right = this.all left = this.all - 9 } } } while (left <= right) { ar.push(left) left++ } if (ar[0] > 1) { ar[0] = 1; ar[1] = -1; } if (ar[ar.length - 1] < this.all) { ar[ar.length - 1] = this.all; ar[ar.length - 2] = 0; } return ar } }, methods: { btnclick: function (page) { this.cur = page; }, nextPage: function () { if (this.cur >= this.all) { this.cur=this.all; }else{ this.cur++; } }, prvePage: function () { if (this.cur <= 1) { this.cur=1; }else{ this.cur--; } }, firstPage: function () { this.cur=1; }, lastPage: function () { this.cur=this.all; }, setButtonClass: function (isNextButton) { if (isNextButton) { return this.cur >= this.all ? "page-button-disabled" : "" } else { return this.cur <= 1 ? "page-button-disabled" : "" } }, setpage:function () { this.$emit('mypage', this.cur); }, pageschange:function () { this.$emit('pageschange', this.selected); } } }) window.Pagination = pagination })()
페이지 매기기.
ul, li { margin: 0; padding: 0; } .page-bar { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; float: right; border-radius: 4px; } .page-bar .info{ float: left; margin-left:16px; font-size: 16px; height: 100%; } .page-bar .showpages{ float: left; font-size: 16px; margin-left: 16px; height: 100%; } .page-bar .showpages .showpages-select{ width: 70px; margin: 0 10px; height: 28px } .page-bar .pagesbtn{ float: left; margin-left:16px; width: 650px; height: 100%; } .page-bar .pagesbtn ul{ text-align: center; width: 100%; } .page-button-disabled { color:#ddd !important; } .page-bar li { list-style: none; display: inline-block; } .page-bar li:first-child > a { margin-left: 0; } .page-bar a { border: 1px solid #ddd; text-decoration: none; position: relative; float: left; padding: 6px 12px; line-height: 1.42857143; color: #337ab7; cursor: pointer; } .page-bar a:hover { background-color: #eee; } .page-bar .active a { color: #fff; cursor: default; background-color: #1e7aca; border-color: #1e7aca; } .page-bar i { font-style: normal; color: #1e7aca; margin: 0 4px; font-size: 12px; }
index.html:
<table class="table table-bordered table-hover "id="ggztable" v-show="isAddSpecifications"> <thead> <tr> <th>规格值</th> <th>操作</th> </tr> </thead> <tbody> <tr v-for="(item,nn) in limitTemps"> <td>{{item.value}}</td> <td> <img src='../img/common_edit@25.png' data-toggle="modal" data-target="#editSonModal" @click="editSonModal(item,nn)" alt='修改'> <img src='../img/common_del@25.png' data-toggle="modal" data-target="#delSonModal" @click="delSonModal(nn)" alt='删除'> </td> </tr> </tbody> </table> <vue-pagination :cur="specificationValCur":all="specificationValAll":info="specificationValInfo" :showpages="specificationValShowpages":selected="specificationValselected" v-on:mypage="getPage" v-on:pageschange="getspecificationValShowPages"> </vue-pagination>
index.js
위 내용은 vue2 기반의 테이블 페이징 컴포넌트 구현 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











기사는 JavaScript 라이브러리 작성, 게시 및 유지 관리, 계획, 개발, 테스트, 문서 및 홍보 전략에 중점을 둡니다.

이 기사는 브라우저에서 JavaScript 성능을 최적화하기위한 전략에 대해 설명하고 실행 시간을 줄이고 페이지로드 속도에 미치는 영향을 최소화하는 데 중점을 둡니다.

프론트 엔드 개발시 프론트 엔드 열지대 티켓 인쇄를위한 자주 묻는 질문과 솔루션, 티켓 인쇄는 일반적인 요구 사항입니다. 그러나 많은 개발자들이 구현하고 있습니다 ...

이 기사는 브라우저 개발자 도구를 사용하여 효과적인 JavaScript 디버깅, 중단 점 설정, 콘솔 사용 및 성능 분석에 중점을 둡니다.

이 기사는 소스 맵을 사용하여 원래 코드에 다시 매핑하여 미니어링 된 JavaScript를 디버그하는 방법을 설명합니다. 소스 맵 활성화, 브레이크 포인트 설정 및 Chrome Devtools 및 Webpack과 같은 도구 사용에 대해 설명합니다.

이 튜토리얼은 Chart.js를 사용하여 파이, 링 및 버블 차트를 만드는 방법을 설명합니다. 이전에는 차트 유형의 차트 유형을 배웠습니다. JS : 라인 차트 및 막대 차트 (자습서 2)와 레이더 차트 및 극지 지역 차트 (자습서 3)를 배웠습니다. 파이 및 링 차트를 만듭니다 파이 차트와 링 차트는 다른 부분으로 나뉘어 진 전체의 비율을 보여주는 데 이상적입니다. 예를 들어, 파이 차트는 사파리에서 남성 사자, 여성 사자 및 젊은 사자의 비율 또는 선거에서 다른 후보자가받는 투표율을 보여주는 데 사용될 수 있습니다. 파이 차트는 단일 매개 변수 또는 데이터 세트를 비교하는 데만 적합합니다. 파이 차트의 팬 각도는 데이터 포인트의 숫자 크기에 의존하기 때문에 원형 차트는 값이 0 인 엔티티를 그릴 수 없습니다. 이것은 비율이 0 인 모든 엔티티를 의미합니다

기술 및 산업 요구에 따라 Python 및 JavaScript 개발자에 대한 절대 급여는 없습니다. 1. 파이썬은 데이터 과학 및 기계 학습에서 더 많은 비용을 지불 할 수 있습니다. 2. JavaScript는 프론트 엔드 및 풀 스택 개발에 큰 수요가 있으며 급여도 상당합니다. 3. 영향 요인에는 경험, 지리적 위치, 회사 규모 및 특정 기술이 포함됩니다.

엔트리 레벨 타입 스크립트 자습서를 마스터 한 후에는 TypeScript를 지원하고 JavaScript로 컴파일하는 IDE에서 자신의 코드를 작성할 수 있어야합니다. 이 튜토리얼은 TypeScript의 다양한 데이터 유형으로 뛰어납니다. JavaScript에는 NULL, UNDEFINED, BOOLEAN, 번호, 문자열, 기호 (ES6에 의해 소개 됨) 및 객체의 7 가지 데이터 유형이 있습니다. TypeScript는이 기반으로 더 많은 유형을 정의 하며이 튜토리얼은이 모든 튜토리얼을 자세히 다룹니다. 널 데이터 유형 JavaScript와 마찬가지로 Null in TypeScript
