Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据格式的bug #36

Open
ncard23 opened this issue Apr 14, 2024 · 5 comments
Open

数据格式的bug #36

ncard23 opened this issue Apr 14, 2024 · 5 comments

Comments

@ncard23
Copy link

ncard23 commented Apr 14, 2024

image

如上图,数据库设计的money的类型是 decimal(10,2),但是php8读取出来以后给到前端的时候自动转为string了

然后前端编辑更新的时候发现不是 number而是string就报错了

这种问题该如何处理会方便一些?谢谢

@build-admin
Copy link
Owner

对于数字输入框,使用v-model.number绑定值应该就可以了,并且给于正确的验证规则,比如数字而不是整数、浮点

@ncard23
Copy link
Author

ncard23 commented Apr 14, 2024

感谢回复,我现在的处理方式是在 php的model里面声明类型,

image

@build-admin
Copy link
Owner

这种方案也没有毛病的哈,点赞~

@ncard23
Copy link
Author

ncard23 commented Apr 14, 2024

我感觉尽量后端改哈,现在写了go和rust以后,发现强类型的语言的好处了,数据类型清晰就更少一点犯错

ps,楼主有没有考虑出一个纯vue版本的后台管理系统,到时候可以用go做后端(当然这不是一个好主意,php做后台管理足够了)

@build-admin
Copy link
Owner

go和rust都是很好的语言,只是精力有限,暂时不会考虑那么多

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants