Vue

Vue模板定义

2018-08-29  本文已影响1人  ChangLau

Vue模板定义

Vue.component('normal', {
    data() {
        return {

        }
    },
    template: `
        <div>
            <h1>Normal template</h1>
        </div>
    `
})
<inline-template inline-template>
    <div>
        <h1>内联模板</h1>
        <p>These are compiled as the component's own template.</p>
        <p>Not parent's transclusion content.</p>
    </div>
</inline-template>
Vue.component('inline-template', {
    data() {
        return {

        }
    }
})
<script type="text/x-template" id="hello-world-template">
    <div>
        <h1>X-Templates模板</h1>
        <p>Hello hello hello</p>
    </div>
</script>
Vue.component('x-template', {
    data() {
        return {

        }
    },
    template: '#hello-world-template'
})
上一篇 下一篇

猜你喜欢

热点阅读