javascript - 如何在数据库中保存换行符
问题描述
我正在使用 typeorm 在服务器上使用 nestjs 框架和在客户端使用 vuejs 来管理我的数据库,
在设置中,我必须提供大文本,并且必须\n
在数据库中保存换行符(),
我的代码:
vue 文本区域
<b-form-textarea
style="white-space: pre-line"
v-model="projectShortDesc"
class="mt-2 description-input"></b-form-textarea>
然后我将这些数据发送v-model="projectShortDesc"
到我的服务器,
@Column({
type: 'varchar',
length: 150,
nullable: true
})
shortDescription: string;
并像这样保存:
project.shortDescription = descFromVue;
await this.conn.getRepository(Project).save(project);
enter
当我输入描述时,有人可以告诉我如何保存在数据库'\ n'中吗?
谢谢你的帮助!
解决方案
推荐阅读
- vb.net - 更改标题栏颜色
- video - FFMPEG 删除在多步过程中创建覆盖视频的步骤
- search - 搜索视图嵌套数组
- python - 如何增加显示的 x 和 y 坐标的位数?
- docker - 构建 docker 容器时 Kubernetes 上的 Jenkins 出现问题
- python - 如何将当前时间与使用 django 保存在数据库中的时间进行比较?
- javascript - 用反应原生元素改变主题不起作用?
- sql - 什么是用于查询带有附件记录 ID 的 Blob 的 Active Record DSL?
- join - 使用子查询的 SQLAlchemy ORM 横向连接
- asp.net-core - jenkin管道中如何将上游项目的DLL传递给下游项目