vue.js - 在 Vue.js 中创建第一个 View

标签 vue.js vuejs2

我正在像这样在 Vuejs 中创建第一个 View :

<template>
  <p>Welcome to MyWebsite</p>
  <p>These terms and conditions outline the rules and regulations for the use of MySite Website.</p> <br />
  <span style="text-transform: capitalize;"> MySite</span> is located at:<br />
  <address>Adresss , City<br />State - 00000, USA<br />
  </address>

</template>

但我总是得到

Welcome to MyWebsite

These terms and conditions outline the rules and regulations for the use of MySite Website.



MySite is located at:
Adresss , City
State - 00000, USA

  • 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.

为什么它推荐我使用 v-if?我不明白我应该在那里做什么?问候

最佳答案

Component template should contain exactly one root element.

<template>
  <div><!-- ONLY ONE DIRECT CHILD IN THE TEMPLATE --> 
    <p>Welcome to MyWebsite</p>
    <p>These terms and conditions outline the rules and regulations for the use of MySite Website.</p> <br />
    <span style="text-transform: capitalize;"> MySite</span> is located at:<br />
    <address>Adresss , City<br />State - 00000, USA<br /></address>
  </div>
</template>

关于vue.js - 在 Vue.js 中创建第一个 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49545096/

相关文章:

docker - vue-router 历史模式在刷新时不起作用

javascript - Vue方法没有返回值

javascript - 是否可以在 Vue.js 中有条件地导入 css 文件?

javascript - v-if 位于 v-for 内以显示一节

vue.js - 如何将组件数据作为json发送到服务器?

javascript - v-for 数组 v-if 中的索引未更新 - Vue.js

javascript - 如何在Vue js中访问子属性

javascript - Vue如何正确遍历列表?

javascript - vue webpack 模板(通过 vue-cli)以后会变得更容易使用吗?

javascript - 在 vuetify 中使用 if on height prop