javascript - Javascript页面刷新并保留参数
问题描述
我有这个页面的参数来自上一页。当我刷新页面时,参数将消失,并且不会显示 youtube 视频。
你可以从这里的 url 看到这个效果:https ://gamecrawl.com/play/xOqFjTR9LG0
{
path: "/play/:id?",
component: _644a45f8,
name: "play-id"
},
有没有办法保留它们以便正确显示视频?
<template>
<div>
<h1 class="text-5xl mt-6">{{ $route.params.title }}</h1>
<div class="bg-gray-100">
<div class="flex content-center px-16 py-8 mt-2">
<iframe
width="854"
height="480"
:src="youtubeurl"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
</div>
<p class="p-8">
{{ $route.params.description }}
</p>
</div>
</div>
</template>
<script>
export default {
props: ["ytid", "description", "title"],
mounted() {
console.log("item id");
console.log(this.ytid);
},
computed: {
youtubeurl() {
return "https://youtube.com/embed/" + this.$route.params.ytid;
}
}
};
</script>
<style scoped></style>
解决方案
推荐阅读
- botframework - 是否可以在最后(Microsoft Bot Framework)中固定网络聊天中的输入窗口?
- java - 我们如何将字符串转换为列表
在 Java 中? - clojure - 为什么匹配地图时匹配子句的顺序很重要?
- r - 从 R Markdown 修改 .bib 文件
- flutter - 如何在验证器中引用表单字段的值或颤振中的另一个表单字段
- c# - 单击的项目不播放歌曲并给出错误“系统找不到指定的文件”
- python - 从矩阵的 3D 堆栈在 numpy/scipy 中构造块对角矩阵的 3D 堆栈的有效方法
- c++ - gcc 模棱两可的模板实例化错误
- mapbox - Mapbox GL JS 忽略属性表达式
- android - 如何在Android上将多个http请求和数据库查询与Rxjava结合起来