Answer the question
In order to leave comments, you need to log in
Why is the frame output as a string?
Tell me why the frame is displayed as a line, and not as a block?
JSON file:
[
{
"iframe": "<iframe src=\"https://www.youtube.com/embed/123\" allowfullscreen></iframe>",
"title": "Испытание",
"body": "эталонного давления взрыва"
},
{
"iframe": "<iframe src=\"https://www.youtube.com/embed/123\" allowfullscreen></iframe>",
"title": "Испытание",
"body": "на искрообразующем механизме"
},
Vue.component('video', {
props: ['loading', 'video'],
template: `
<div class="grid-card grid-3">
<div v-if="loading">
loading...
</div>
<template v-else v-for="{iframe, title, body} in video">
<div class="card">
<div class="card-content">
{{ iframe }}
</div>
<div class="card-name">
<h3 class="card-title">{{ title }}</h3>
<p>{{ body }}</p>
</div>
</div>
</template>
</div>
`,
});
const videos = 'js/videos.json' ;
new Vue({
el: '#app',
data() {
return {
loading: true,
video: [],
}
},
created() {
axios.get(videos).then((response) => {
this.video = response.data
this.loading = false
}),
},
props: {
iframe: {
type: Object,
},
},
});
{{ iframe }}
with<iframe :src="{ iframe }" allowfullscreen></iframe>
, does not work.
Answer the question
In order to leave comments, you need to log in
Because html is rendered differently in vue!!
<div
class="card-content"
v-html="iframe"
/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question