48 lines
936 B
HTML
48 lines
936 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<apps>
|
|
<div slot-scope="item">
|
|
<h1>这是父组件</h1>
|
|
<span v-for="li in item">
|
|
<span>{{li.join("-")}}</span>
|
|
</span>
|
|
</div>
|
|
</apps>
|
|
</div>
|
|
|
|
<template id="tpl">
|
|
<div>
|
|
<slot :item="list">
|
|
<ul>
|
|
<li v-for="item in list">{{item}}</li>
|
|
</ul>
|
|
</slot>
|
|
</div>
|
|
</template>
|
|
|
|
</body>
|
|
<script src="../../JavaScript/vue.js"></script>
|
|
<script>
|
|
new Vue({
|
|
el:"#app",
|
|
components:{
|
|
'apps':{
|
|
template:"#tpl",
|
|
data(){
|
|
return {
|
|
list:['这是内容1','这是内容2','这是内容3']
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
</html> |