【问题标题】:Vue js Template tagVue js模板标签
【发布时间】:2021-06-17 17:50:09
【问题描述】:

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

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

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

【问题讨论】:

    标签: vue.js


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      # 是 vue v-slot: 的简写。 can read a perfect example here

      【讨论】:

        猜你喜欢
        • 2019-04-01
        • 2019-01-29
        • 1970-01-01
        • 1970-01-01
        • 2019-12-01
        • 1970-01-01
        • 2020-11-28
        • 2017-07-11
        • 2020-09-02
        相关资源
        最近更新 更多