58 lines
1.2 KiB
HTML
58 lines
1.2 KiB
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>
|
||
<!--
|
||
slot插槽使用必须在模板内部有定义slot标签,通过使用组件模板传递插槽内容传递过去
|
||
-->
|
||
<div id="app">
|
||
<apps>
|
||
<div>这是一个span标签</div>
|
||
<span>哈哈哈</span>
|
||
</apps>
|
||
<apps>
|
||
<div>这是一个span标签</div>
|
||
<span>呵呵呵</span>
|
||
</apps>
|
||
<apps>
|
||
<div>
|
||
<div>这是一个span标签</div>
|
||
<span>耶耶耶</span>
|
||
</div>
|
||
</apps>
|
||
<apps></apps>
|
||
<apps></apps>
|
||
<apps>
|
||
<div>这是一个单选框</div>
|
||
<input type="radio" name="" id="">
|
||
</apps>
|
||
</div>
|
||
<template id="tpl">
|
||
<div>
|
||
<div>
|
||
<slot>
|
||
<div>这是一个按钮</div>
|
||
<button>按钮</button>
|
||
</slot>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</body>
|
||
<script src="../../JavaScript/vue.js"></script>
|
||
<script>
|
||
new Vue({
|
||
el:"#app",
|
||
components:{
|
||
'apps':{
|
||
template:"#tpl",
|
||
|
||
}
|
||
}
|
||
})
|
||
</script>
|
||
</html> |