B
B
Banan442020-05-27 20:29:46
Vue.js
Banan44, 2020-05-27 20:29:46

Error with props in components, how to solve?

Vue.component('blog-post', {
  props: ['title', 'text'],
  template: `
    <h3>{{title}}</h3>
    <p>{{text}}</p> <!-- Ошибка -->
  `
})

const app = new Vue({
  el: '#app'
})

<div id="app">
  <blog-post title="Hello Vue.js" text="Vue.js this is amazing!"></blog-post>
</div>

Why does it give an error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-05-27
@Banan44

because

template should contain exactly one root element

Your cap.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question