简体   繁体   English

Vue js 模板标签

[英]Vue js Template tag

I'm looking at an existing Vue code base and I am seeing <template> tags like:我正在查看现有的 Vue 代码库,我看到了<template>标签,例如:

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

I know each vue component is enclosed in the <template> tag but I've never seen #default or #content embedded within the template tag before.我知道每个 vue 组件都包含在<template>标签中,但我以前从未见过#default#content嵌入模板标签中。 What is the purpose of this?这样做的目的是什么? I'm suspecting those # are customisable but you just have to define them?我怀疑那些#是可定制的,但你只需要定义它们? If that is the case, where would I be able to find it in a vue project?如果是这种情况,我可以在 vue 项目中的哪里找到它? I'm assuming there is a standard location to store files like this in a vue project.我假设有一个标准位置可以在 vue 项目中存储这样的文件。 Thank you.谢谢你。

# in a template tag is simply shorthand for v-slot: . #template标签中只是v-slot:简写。 See: https://v3.vuejs.org/guide/component-slots.html#named-slots-shorthand参见: https : //v3.vuejs.org/guide/component-slots.html#named-slots-shorthand

the # is a shorthand for vue v-slot . #是 vue v-slot的简写。 can read a perfect example here可以在这里阅读一个完美的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM