如何在Swal文本中添加引号,而不被替换为"?

huangapple go评论60阅读模式
英文:

How to add quotes in Swal text without being replaced with "?

问题

const sc = {...swalConfig.confirm};
sc.text = "{{ __('将记录从表格 \"USERS\" 复制到表格 \"ROLES\",不进行任何额外操作。') }}";

我有这段代码。但在浏览器中渲染时,\"显示为"。有什么办法可以避免这种情况?

英文:

const sc = {...swalConfig.confirm};
sc.text = "{{ __('Taking the records from the table \"USERS\" to the "ROLES" table, without any additional action.') }}";

I have this code. But when rendered in browser the \" is shown as ". Any idea how to avoid this?

答案1

得分: 1

var text = {!! __('从表格 "USERS" 拿记录到 "ROLES" 表,不需要任何额外操作。') !!};
console.log(text);

英文:

You should embed it as html. Try this:

var text = `{!! __('Taking the records from the table \"USERS\" to the \"ROLES\" table, without any additional action.') !!}`;
console.log(text);

huangapple
  • 本文由 发表于 2023年3月15日 18:23:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/75743399.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定