第一种、父子组件都在一个文件里面
效果如下
代码如下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="app">
<div v-for="(d,index) in counter" :key="index">
<dom :mess="d.d" :info="d.t"></dom>
</div>
<button @click="add">添加</button>
</div>
<script type = "text/javascript">
Vue.component('dom', {
template: '<div>{
{mess}}{
{info}}<