The generated id is too long to cause insemination when JS gets it.

because the length of the id generated by the id, generated by the SnowFlake algorithm is 19, and then it is found that the id obtained by the frontend is not consistent with the one we passed, and it is found that the js has lost sperm due to excessive length when parsing the id. The current solution is to convert id into a string. I would like to ask if there is any other elegant way to solve the problem of insemination caused by too long numerical length in js

Jan.26,2022

then you have to write your own handwritten function parseJSON to parse numbers into bigint (and compatibility issues). Do you think it's more elegant than string?
and you can convert id to hexadecimal text, but the length will be shorter


background conversion string is the best choice


No, first exclude the Number type, the rest of the most suitable type is String


the way to convert string is not elegant? If you set up a convert for spring mvc, you will ok

.
Menu