Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript vue ssr如何在脚本标记中添加属性_Javascript_Vue.js - Fatal编程技术网

Javascript vue ssr如何在脚本标记中添加属性

Javascript vue ssr如何在脚本标记中添加属性,javascript,vue.js,Javascript,Vue.js,我将文档guid与一起使用,但我找不到任何方法在脚本标记上添加自定义属性。我想在脚本标记上添加crossorigin=“anonymous,以获得正确的错误,而不是“script error”。我找到了一种为scaript标记添加自定义属性的方法 只需使用·手动资产注入·然后获取脚本字符串,然后对其进行更改 文件在这里:https://ssr.vuejs.org/zh/guide/build-config.html#%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%

我将文档guid与一起使用,但我找不到任何方法在脚本标记上添加自定义属性。我想在脚本标记上添加
crossorigin=“anonymous
,以获得正确的错误,而不是“script error”。

我找到了一种为scaript标记添加自定义属性的方法 只需使用·手动资产注入·然后获取脚本字符串,然后对其进行更改 文件在这里:https://ssr.vuejs.org/zh/guide/build-config.html#%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE-客户端配置

守则:

const content=await bundlerender.renderString(上下文);
console.log('context.rendersourcehints()',context.rendersourcehints())
console.log('context.renderStyles()',context.renderStyles())
console.log('context.renderScripts()',context.renderScripts())
常量html=`
${context.renderResourceHitts()}
${context.renderStyles()}
你好Vue 13
${content}
${context.renderScripts()}
`.trim();
res.send(html);
结果是:

context.renderResourceHights()
context.renderStyles()
context.renderScripts()

我们得到了字符串,我们可以对其进行更改吗?

让我们提供一些代码,让大家知道现在该怎么做,这样每个人都可以以正确的方式重定向您