admin管理员组文章数量:1410705
I have no experience with Vue or JS.
I want to pass a YouTube link from data() to iFrame.
Can this be done?
If so what steps are necessary to do so?
The code below shows what I have so far, though I'm not even sure if it's correct, as this is my first time in Vue.js and JS world.
I have looked here and elsewhere for ideas on how to do this but have not yet found anything I can use.
Any helpful tips are greatly appreciated, thank you.
<template>
<div>
<iframe width="800" height="230" src=this.link></iframe>
</div>
</template>
<script>
import axios from "axios";
export default{
name:"Camera",
data(){
return{
link:";,
};
},
methods:{
OnSelectCam(link){
this.link = link;
},
},
}
</script>
<style scoped>
</style>
I have no experience with Vue or JS.
I want to pass a YouTube link from data() to iFrame.
Can this be done?
If so what steps are necessary to do so?
The code below shows what I have so far, though I'm not even sure if it's correct, as this is my first time in Vue.js and JS world.
I have looked here and elsewhere for ideas on how to do this but have not yet found anything I can use.
Any helpful tips are greatly appreciated, thank you.
<template>
<div>
<iframe width="800" height="230" src=this.link></iframe>
</div>
</template>
<script>
import axios from "axios";
export default{
name:"Camera",
data(){
return{
link:"https://www.youtube./embed/08Xmfi1QIxc",
};
},
methods:{
OnSelectCam(link){
this.link = link;
},
},
}
</script>
<style scoped>
</style>
Share
Improve this question
asked Oct 29, 2021 at 17:36
Jim GallagherJim Gallagher
491 gold badge1 silver badge4 bronze badges
2 Answers
Reset to default 4 <iframe width="800" height="230" :src="link"></iframe>
You need to add : before src and "" to the variable name. You don't need this. inside the template.
You need to bind your link value to the src attribute of your iframe
like this
<iframe width="800" height="230" :src=this.link></iframe>
本文标签: javascriptHow to Pass URL to iFrame in VuejsStack Overflow
版权声明:本文标题:javascript - How to Pass URL to iFrame in Vue.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744899045a2631235.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论