首页 > 解决方案 > Vue js模板标签

问题描述

我正在查看现有的 Vue 代码库,并且看到<template>如下标签:

<template #default>
<template #content>
<template #close>

我知道每个 vue 组件都包含在<template>标签中,但我以前从未见过#default#content嵌入在模板标签中。这样做的目的是什么?我怀疑这些#是可定制的,但你只需要定义它们?如果是这种情况,我在哪里可以在 vue 项目中找到它?我假设有一个标准位置可以在 vue 项目中存储这样的文件。谢谢你。

标签: vue.js

解决方案


#template标签中只是 . 的简写v-slot:。见:https ://v3.vuejs.org/guide/component-slots.html#named-slots-shorthand


推荐阅读