当前位置:网站首页>js方法传Long类型id值时会出现精确损失
js方法传Long类型id值时会出现精确损失
2022-07-05 20:02:00 【土味儿~】
比如:onclick="test(1543401283015196673)"
传递的参数是 1543401283015196673
,而在js方法内接收时会变成 1543401283015196700
,最后三位 673
,四舍五入后,变成了 700
这个坑浪费了我几个小时,经过反复测试,最后才发现。记录一下。
解决方法:
把Long类型转为字符串,加引号;
onclick="test('1543401283015196673')"
thymeleaf正确写法:th:onclick="|test('${user.getId()}')|"
;
下面两种写法都是错误的:
th:onclick="'test('+${''+user.getId()}+')'"
th:onclick="'test('+${user.getId().toString()}+')'"
边栏推荐
- Go language | 01 wsl+vscode environment construction pit avoidance Guide
- What is the core value of testing?
- .Net分布式事务及落地解决方案
- sun.misc.BASE64Encoder报错解决方法[通俗易懂]
- 【obs】libobs-winrt :CreateDispatcherQueueController
- ffplay文档[通俗易懂]
- Webuploader file upload drag upload progress monitoring type control upload result monitoring control
- 【无标题】
- CADD课程学习(7)-- 模拟靶点和小分子相互作用 (半柔性对接 AutoDock)
- Inventory of the most complete low code / no code platforms in the whole network: Jiandao cloud, partner cloud, Mingdao cloud, Qingliu, xurong cloud, Jijian cloud, treelab, nailing · Yida, Tencent clo
猜你喜欢
图嵌入Graph embedding学习笔记
Successful entry into Baidu, 35K monthly salary, 2022 Android development interview answer
港股将迎“最牛十元店“,名创优品能借IPO突围?
Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises
.Net分布式事务及落地解决方案
What is the core value of testing?
js实现禁止网页缩放(Ctrl+鼠标、+、-缩放有效亲测)
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (半柔性对接 AutoDock)
Xaas trap: all things serve (possible) is not what it really needs
How about testing outsourcing companies?
随机推荐
C#应用程序界面开发基础——窗体控制(5)——分组类控件
Debezium series: PostgreSQL loads the correct last submission LSN from the offset
Concept and syntax of function
函数的概念及语法
Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises
成功入职百度月薪35K,2022Android开发面试解答
建立自己的网站(16)
Add data to excel small and medium-sized cases through poi
Build your own website (16)
Let's talk about threadlocalinsecurerandom
sun. misc. Base64encoder error reporting solution [easy to understand]
Ffplay document [easy to understand]
Where is the operation of new bonds? Is it safer and more reliable to open an account
Interviewer: what is the internal implementation of set data types in redis?
Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
Multi branch structure
openh264解码数据流向分析
国信证券在网上开户安全吗?
[C language] three implementations of quick sorting and optimization details
ICTCLAS用的字Lucene4.9捆绑