【VUE】Unterminated template literal:拼接字符串包括<script></script>时报错误

vue拼接字符串包括时报错误提示Unterminated template literal

vue拼接字符串包括script标签时报错误提示Unterminated template literal解决方法加反斜杠就可以,在script结束标签里边加反斜杠<\/script>
在这里插入图片描述

代码

      htmlData: `
<div id="b0e5c00cc51e4a4a823fb2e1097186f0" class="chart-container" style="width:900px; height:500px; "></div>
    <script>
    document.getElementById('b0e5c00cc51e4a4a823fb2e1097186f0').innerHTML = 'test'
    <\/script>`

猜你喜欢

转载自blog.csdn.net/Maxueyingying/article/details/131640905