<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.panel{
max-width: 300px;
border:1px solid #999;
margin-bottom: 15px;
}
.panel>*{
padding: 15px;
}
.panel .title{
border-bottom: 1px solid #999;
}
.panel .footer{
border-top: 1px solid #999;
}
</style>
</head>
<body>
<div id="app">
<panel><div slot="title">我是你大爷</div><div slot="content">xxxxxxxxxxxx</div></panel>
<panel><div slot="content">yyyyyyyyyyyy</div></panel>
<panel><div slot="content">zzzzzzzzzzzz</div><div slot="footer">我是你二大爷</div></panel>
</div>
<template id="panel-tpl">
<div class="panel">
<div class="title">
<slot name="title">默认的头部信息</slot>
</div>
<div class="content">
<slot name="content">默认的主体内容</slot>
</div>
<div class="footer">
<slot name="footer">默认的尾部信息</slot>
</div>
</div>
</template>
<script src="../lib/vue.js"></script>
<script src="js/main.js"></script>
</body>
</html>
Vue.component("panel",{
template:"#panel-tpl"
});
new Vue({
el:"#app",
data:{
}
})