当前位置:网站首页>Address bar parameter transmission of list page based on jeecg-boot
Address bar parameter transmission of list page based on jeecg-boot
2022-07-06 06:25:00 【Hanyue Zhuge crossbow】
Pre knowledge :
1、 What is address bar parameter passing ? What is the format of address bar parameter transmission (? Variable 1= value 1& Variable 2= value 2……)
2、 If you pass JavaScript Get address bar parameters ( There are various solutions on the Internet )
My method ( Put it in util.js in ):
export function getUrlParam(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r!=null) return decodeURI(r[2]); return '';
}
3、 Yes jeecg Of mixin Understanding ( Look at the code , See the development documents )
The main implementation :
1、 Build a general method to obtain address bar parameters
Because the address bar parameter acquisition is a very common method , So find it on the Internet js After obtaining the solution for the address bar parameters , You can add it to jeecg-boot Of :src/utils/util.js in
/**
* Get the specified parameters from the address bar
* @param {*} name
*/
export function getUrlParam(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r!=null) return decodeURI(r[2]); return '';
}
2、JEECG-BOOT Understanding of code in
The key :src/mixins/JeecgListMixin.js
(1) Blend in coverage : This mixin.js yes jeecg To simplify front-end operations , Many general codes are packaged . meanwhile ,jeecg-boot It also provides us with an interface that can be mixed ,
In the picture above disableMixinCreated It is the judgment variable mixed with coverage
(2) Conditional generation
In the picture above queryParam It is based on the filter conditions to be built by the entity , The method in the figure above is loadData(arg) In the called , as follows :
(3) Data acquisition
Jeecg-boot Yes axios Further encapsulation , Here is getAction, There's another. postAction etc. , Execute different types of requests separately , Just call it directly in the process of use , The specific code is in :src/api/manage.js( Not detailed here , Because there is no need to modify )
getAction,postActon And so on are often used when we write code , So here you can see jeecg Official call code , Convenient for subsequent self simulation .
3、list Page coding
Understand section 2 After the principle of step , In the 1 On the basis of step, we can implement it very simply list Transfer and configuration of page parameters :
(1) stay list Page data Some settings :disableMixinCreated:true
(2) stay created Partial get parameters , And call mixin Code
Be careful :(1) If in list The page is not configured disableMixinCreated:true, Then the code will not be mixed with coverage ,list The request will be loaded twice .
(2) If the first 2 I can't understand the steps , No problem , Let's first 1 Step code into util.js in , Then according to the 3 The step method is directly in list Just write code in the page .
边栏推荐
- Selenium source code read through · 9 | desiredcapabilities class analysis
- Black cat takes you to learn UFS Protocol Part 8: UFS initialization (boot operation)
- 黑猫带你学UFS协议第8篇:UFS初始化详解(Boot Operation)
- 模拟卷Leetcode【普通】1061. 按字典序排列最小的等效字符串
- LeetCode 1200. 最小绝对差
- LeetCode 729. My schedule I
- 这些年用Keil遇到的坑
- 测试周期被压缩?教你9个方法去应对
- win10无法操作(删除、剪切)文件
- Black cat takes you to learn EMMC Protocol Part 10: EMMC read and write operation details (read & write)
猜你喜欢
[wechat applet] build a development tool environment
sourceInsight中文乱码
数据库隔离级别
Oscp raven2 target penetration process
Apple has open source, but what about it?
org. activiti. bpmn. exceptions. XMLException: cvc-complex-type. 2.4. a: Invalid content beginning with element 'outgoing' was found
Full link voltage measurement: building three models
Customize the gateway filter factory on the specified route
Luogu p2089 roast chicken
基於JEECG-BOOT的list頁面的地址欄參數傳遞
随机推荐
keil MDK中删除添加到watch1中的变量
MySQL之数据类型
Simulation volume leetcode [general] 1249 Remove invalid parentheses
Private cloud disk deployment
Avtiviti创建表时报错:Error getting a new connection. Cause: org.apache.commons.dbcp.SQLNestedException
JDBC requset corresponding content and function introduction
[postman] the monitors monitoring API can run periodically
JWT-JSON WEB TOKEN
Luogu p2141 abacus mental arithmetic test
在uni-app中使用腾讯视频插件播放视频
LeetCode 1200. 最小绝对差
Summary of the post of "Web Test Engineer"
Career advancement Guide: recommended books for people in big factories
数据库隔离级别
调用链监控Zipkin、sleuth搭建与整合
Apple has open source, but what about it?
An article was uncovered to test the truth of outsourcing companies
Luogu p2089 roast chicken
Simulation volume leetcode [general] 1219 Golden Miner
Web界面元素的测试