slot的意思是插槽,想想你的电脑主板上的各种插槽,有插CPU的,有插显卡的,有插内存的,有插硬盘的,所以假设有个组件是computer,其模板是
那么你要攒一个牛逼轰轰的电脑,就可以这么写:
<template> <div> <slot name="CPU">这儿插你的CPU</slot> <slot name="GPU">这儿插你的显卡</slot> <slot name="Memory">这儿插你的内存</slot> <slot name="Hard-drive">这儿插你的硬盘</slot> </div> </template>
<template> <computer> <div slot="CPU">Intel Core i7</div> <div slot="GPU">GTX980Ti</div> <div slot="Memory">Kingston 32G</div> <div slot="Hard-drive">Samsung SSD 1T</divt> </computer> </template>