插槽slot

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>Titletitle>
    <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">xxxxxxxxxxxxdiv>panel>
    <panel><div slot="content">yyyyyyyyyyyydiv>panel>
    <panel><div slot="content">zzzzzzzzzzzzdiv><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:{

    }
})

 

上一篇:restFull api接口


下一篇:Java成员内部类