猿问

vue.js中<templete>标签的用法?

为什么<templete>标签里要再放一个常规标签(比如div标签),下面这段代码才不会出错

要这样写

<templete>

<div>

<el-button type="text" @click="centerDialogVisible = true">点击打开 Dialog</el-button>

<el-dialog
  title="提示"
  :visible.sync="centerDialogVisible"
  width="30%"
  center>
  <span>需要注意的是内容是默认不居中的</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="centerDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
  </span>
</el-dialog>

</div>

</templete>

而不是这样写呐

<templete>

<el-button type="text" @click="centerDialogVisible = true">点击打开 Dialog</el-button>

<el-dialog
  title="提示"
  :visible.sync="centerDialogVisible"
  width="30%"
  center>
  <span>需要注意的是内容是默认不居中的</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="centerDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
  </span>
</el-dialog>

</templete>

Jenny_xiong
浏览 2259回答 1
1回答

cxxyjsj

vue2.0要求模板必须要有一个根节点, 并且截图中<template>还拼错了
随时随地看视频慕课网APP

相关分类

Vue.js
我要回答