How to pass URL to iFrame in Vue.js
P粉237029457
P粉237029457 2024-02-17 11:23:04
0
1
385

I have no experience with Vue or JS.

I want to pass YouTube link from data() to iFrame.

Can this be done?

If so, what steps need to be taken?

The code below shows what I have so far, although I'm not even sure if it's correct since this is my first time into the world of Vue.js and JS.

I've looked here and elsewhere for ideas on how to do this, but haven't found anything I can use yet.

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.com/embed/08Xmfi1QIxc",
         
     };
     },
    methods:{
        
        OnSelectCam(link){
            this.link = link;
        },    
            
        },
   
}   
   
</script>

<style scoped>
</style>

P粉237029457
P粉237029457

reply all(1)
P粉387108772

You need to add : before src and "" in the variable name. You don't need this. within the template.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template