我正在使用 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' 中吗?
感谢您的帮助!