当前位置:网站首页>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()}+')'"
边栏推荐
- [untitled]
- C application interface development foundation - form control (6) - menu bar, toolbar and status bar controls
- Parler de threadlocal insecurerandom
- Recommended collection, my Tencent Android interview experience sharing
- [FAQ] summary of common causes and solutions of Huawei account service error 907135701
- Zhongang Mining: analysis of the current market supply situation of the global fluorite industry in 2022
- Cocos2d-x项目总结中的一些遇到的问题
- Debezium series: modify the source code to support UNIX_ timestamp() as DEFAULT value
- 什么是pyc文件
- 618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
猜你喜欢
Go language | 03 array, pointer, slice usage
力扣 729. 我的日程安排表 I
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
After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
.Net分布式事务及落地解决方案
ACM getting started Day1
Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
Leetcode brush question: binary tree 14 (sum of left leaves)
leetcode刷题:二叉树13(相同的树)
Force buckle 1200 Minimum absolute difference
随机推荐
.Net分布式事务及落地解决方案
【obs】libobs-winrt :CreateDispatcherQueueController
40000 word Wenshuo operator new & operator delete
What is the function of okcc call center
Ffplay document [easy to understand]
That's awesome. It's enough to read this article
C application interface development foundation - form control (5) - grouping control
手机股票开户安全吗?靠不靠谱啊?
Build your own website (16)
sun.misc.BASE64Encoder报错解决方法[通俗易懂]
Multi branch structure
安信证券在网上开户安全吗?
解决Thinkphp框架应用目录下数据库配置信息修改后依然按默认方式连接
Go language | 02 for loop and the use of common functions
银河证券在网上开户安全吗?
Win10 x64环境下基于VS2017和cmake-gui配置使用zxing以及opencv,并实现data metrix码的简单检测
What are general items
Parler de threadlocal insecurerandom
Debezium series: modify the source code to support UNIX_ timestamp() as DEFAULT value
C langue OJ obtenir PE, ACM démarrer OJ