Answer the question
In order to leave comments, you need to log in
Component template should contain exactly one root element Vue2?
<div id="app">
<counter></counter>
</div>
<template id="custom_template">
<h1>Heading</h1>
<button type="submit">
@{{ counter }}
</button>
</template>
<script type="text/javascript">
Vue.component('counter', {
template: '#custom_template',
data: function () {
return {
counter: 0
}
}
});
new Vue({
el: "#app",
});
</script>
[Vue warn]: Error compiling template:
<h1>Heading</h1>
<button type="submit">
{{ counter }}
</button>
- Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
(found in <Counter>)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question