File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,23 @@ ID 作为主键的默认声明方式=={.note}
6161- 传统自增 ID 在数据迁移或合并时需特别注意冲突问题
6262- ==前端渲染长整数偏移=={.danger}
6363
64- 当后端 api 返回长整数时,返回结果是没有问题的,但是通过前端组件渲染为 table 等数据之后 ,可能导致长整数渲染错误。
64+ 当后端 api 返回长整数时,返回结果是没有问题的,但是通过前端渲染数据后 ,可能导致长整数渲染错误。
6565
66- 通过浏览器控制台打印可以发现,前端渲染后的数据 id 与返回数据不一致,最佳解决方法是:后端将长整数序列化为字符串之后再返回,例如:
66+ 通过浏览器控制台可以发现,前端渲染后的数据 id 与返回数据不一致,最佳解决方法是:后端将长整数序列化为字符串之后再返回
67+
68+ ::: tabs
69+ @tab schemaBase
70+
71+ ``` python
72+ @field_serializer (' id' , check_fields = False )
73+ def serialize_id (self , value ) -> str :
74+ return str (value)
75+ ```
76+
77+ @tab GetXxxDetail / GetXxxTree
6778
6879 ``` python
69- # 在 schemaBase 或返回数据 schema 中添加以下字段序列化器
70- @field_serializer (" id" )
80+ @field_serializer (' id' )
7181 def serialize_id (self , value ) -> str :
7282 return str (value)
7383 ```
You can’t perform that action at this time.
0 commit comments