The paging effect is implemented in the vue project for your reference. The specific contents are as follows 1. Here we use element-ui to implement it. First install it using npm npm i element-ui -S 2. Globally import in main.js import ElementUI from "element-ui" import 'element-ui/lib/theme-chalk/index.css' Vue.use(ElementUI) //Hang element-ui globally 3. Packaging components <template> <div class="block"> <el-pagination @current-change="handleCurrentChange" :current-page="currentPage" :page-size="6" layout="prev, pager, next, jumper" :total="total" :pager-count="5" > </el-pagination> </div> </template> <script> export default { props: ["num", "page"], //The total number of entries passed in, and the page number data() { return {}; }, computed: { currentPage: function() { return this.page; }, total: function() { return this.num; } }, methods: { handleSizeChange(val) { this.$emit("size-change", val); }, handleCurrentChange(val) { this.$emit("current-change", val); } } }; </script> <style> .block { text-align: right; /* width: 100%; */ } </style> 4. Import components and use them <template> <div class="mobild"> <div> <ATablePaging :num="num" :page="page" @current-change="(val) => { page = val; list(); }" ></ATablePaging> </div> </div> </template> <script> import ATablePaging from "../paging"; //Introduce the paging component export default { data() { return { page:"", //Current page number num: 1, //Total number of content items}; }, methods: { list() { //The total number of pages returned by the backend is equal to num }, }, mounted() { this.news(); }, components: ATablePaging } }; </script> <style scoped> </style> Regarding the learning tutorial of vue.js, please click on the special topics vue.js component learning tutorial and Vue.js front-end component learning tutorial for learning. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Diagram of the process from uninstallation to installation of MySQL 5.7.18 yum under Linux
>>: Detailed explanation of Nginx proxy_redirect usage
1Several common character sets In MySQL, the most...
Installation of Python 3 1. Install dependent env...
Table of contents What is a trigger Create a trig...
The author has been working on a micro-frontend p...
Preface Recently, I added two fields to a table i...
The first time I wrote a MySQL FUNCTION, I kept g...
Check the transaction isolation level In MySQL, y...
Overview The project was created successfully and...
The domestic market still has a certain demand fo...
Part.0 Background The company's intranet serv...
1. Install mysql Run the following command to upd...
0. Introduction What is the ibdata1 file? ibdata1...
Scenario You need to authorize the tester to use ...
This article example shares the specific code of ...
First, a common question is, what is the relation...