我不明白为什么它不起作用这让我发疯
<template>
<p>{{ greeting }}</p>
</template>
<script>
export default {
name: 'App',
data: function(){
return {
greeting: 'this is message'
}
}
}
</script>
为什么{{ greeting }}
不工作?它应该运行文本。但我得到了这个错误
错误编译模板:
组件模板应该只包含一个根元素。如果您在多个元素上使用v-if,请使用v-else-if来链接它们。
谁能帮我这个 ?
你应该在你的<div>
标签里面有一个app
和一个id <template>
<template>
<div id="app">{{greeting}}</div>
</template>
<script>
export default {
name: "App",
data: function() {
return {
greeting: "this is message"
};
}
};
</script>