这个HTML很好,TikTok视频显示得很完美(简单的index.html文件)。但问题是,当我在VUE js中使用这段代码时,它会给我一个CORS错误。

<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://www.tiktok.com/embed.js"></script>
</head>
<blockquote class="tiktok-embed" cite="https://www.tiktok.com/@zachking/video/6904661755687865605"
data-video-id="6904661755687865605" style="max-width: 605px;min-width: 325px;">
<section> <a target="_blank" title="@zachking" href="https://www.tiktok.com/@zachking">@zachking</a>
<p>What’s the longest amount of time you’ve been stuck in <a title="traffic" target="_blank"
href="https://www.tiktok.com/tag/traffic">#traffic</a> ? �</p> <a target="_blank"
title="♬ original sound - Zach King" href="https://www.t
k.com/music/original-sound-6904661761874479877">♬ original sound - Zach King</a>
</section>
</blockquote>
<video></video>
</html>我将这个脚本标记放在头部分的vue的index.html文件中。
<script async src="https://www.tiktok.com/embed.js"></script> 我不知道它为什么会让CORS出错。有什么解决办法吗?
发布于 2022-04-05 18:29:57
在我的例子中,这个代码工作得很好。
// In the template of the Vue file
<iframe :src="videoUrl" :srcdoc="embedHtml"></iframe><script async src="https://www.tiktok.com/embed.js"></script>在index.html的头部标记是不必要的。
https://stackoverflow.com/questions/65352656
复制相似问题