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

防止 MyCat 吞掉某些字符 #138

Open
lovelmh13 opened this issue Jul 26, 2021 · 0 comments
Open

防止 MyCat 吞掉某些字符 #138

lovelmh13 opened this issue Jul 26, 2021 · 0 comments

Comments

@lovelmh13
Copy link
Owner

if (process.env.NODE_ENV !== 'development') {
    // 区分线上环境,只有线上环境才有 MyCat
    componentData = componentData
      .replace(/\\n/g, '\\\\n')
      .replace(/\\"/g, '\\\\"')
      .replace(/\\t/g, '\\\\t')
      .replace(/\\b/g, '\\\\b')
      .replace(/\\f/g, '\\\\f')
      .replace(/\\r/g, '\\\\r')
}

一定要在入库的时候,使用 sql 的时候再使用这个方法,不要一上来就用,不然序列化会出问题的!!!!!!!

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

1 participant