当前位置:网站首页>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()}+')'"
边栏推荐
- 95后阿里P7晒出工资单:狠补了这个,真香...
- Based on vs2017 and cmake GUI configuration, zxing and opencv are used in win10 x64 environment, and simple detection of data matrix code is realized
- Multi branch structure
- 【obs】QString的UTF-8中文转换到blog打印 UTF-8 char*
- Thread pool parameters and reasonable settings
- Where is the operation of new bonds? Is it safer and more reliable to open an account
- 1:引文;
- Recommended collection, my Tencent Android interview experience sharing
- Gstreamer中的task
- Build your own website (16)
猜你喜欢

城链科技数字化创新战略峰会圆满召开

建立自己的网站(16)

Build your own website (16)

leetcode刷题:二叉树16(路径总和)

After 95, Alibaba P7 published the payroll: it's really fragrant to make up this

微信小程序正则表达式提取链接

js实现禁止网页缩放(Ctrl+鼠标、+、-缩放有效亲测)

ACM getting started Day1

【无标题】

C application interface development foundation - form control (5) - grouping control
随机推荐
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
通配符选择器
Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
Worthy of being a boss, byte Daniel spent eight months on another masterpiece
openh264解码数据流向分析
Database logic processing function
Zhongang Mining: analysis of the current market supply situation of the global fluorite industry in 2022
leetcode刷题:二叉树10(完全二叉树的节点个数)
Android interview classic, 2022 Android interview written examination summary
c語言oj得pe,ACM入門之OJ~
Two pits exported using easyexcel template (map empty data columns are disordered and nested objects are not supported)
淺淺的談一下ThreadLocalInsecureRandom
Win10 x64环境下基于VS2017和cmake-gui配置使用zxing以及opencv,并实现data metrix码的简单检测
Thread pool parameters and reasonable settings
Interviewer: what is the internal implementation of set data types in redis?
股票开户哪里好?网上客户经理开户安全吗
深度学习 卷积神经网络(CNN)基础
Bitcoinwin (BCW) was invited to attend Hanoi traders fair 2022
Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises