Slot 中文

2021年5月8日
Register here: http://gg.gg/uizmf
You’re browsing the documentation for v2.x and earlier. For v3.x, click here.
This page assumes you’ve already read the Components Basics. Read that first if you are new to components.
In 2.6.0, we introduced a new unified syntax (the v-slot directive) for named and scoped slots. It replaces the slot and slot-scope attributes, which are now deprecated, but have not been removed and are still documented here. The rationale for introducing the new syntax is described in this RFC.
This page assumes you’ve already read the Components Basics.Read that first if you are new to components. In 2.6.0, we introduced a new unified syntax (the v-slot directive) for named and scoped slots.
T 形槽; t形槽 ’t’中文翻译 中世纪罗马数字的160。 ’slot’中文翻译 n. 〔英方〕门闩;〔方言〕条板。 ’slot’中文翻译 slot1 n. 1.狭缝,窄孔;【机械工程】漕沟;自动售货机投钱口。 2.【航空】翼缝。 3. Slot 1 refers to the physical and electrical specification for the connector used by some of Intel’s microprocessors, including the Pentium Pro, Celeron, Pentium II and the Pentium III. Both single and dual processor configurations were implemented.Slot Content
Vue implements a content distribution API inspired by the Web Components spec draft, using the <slot> element to serve as distribution outlets for content.
This allows you to compose components like this:
Then in the template for <navigation-link>, you might have: How do you play baccarat in the casino.
When the component renders, <slot></slot> will be replaced by “Your Profile”. Slots can contain any template code, including HTML:
Or even other components:
If <navigation-link>‘s template did not contain a <slot> element, any content provided between its opening and closing tag would be discarded.Compilation Scope
When you want to use data inside a slot, such as in:
That slot has access to the same instance properties (i.e. the same “scope”) as the rest of the template. The slot does not have access to <navigation-link>‘s scope. For example, trying to access url would not work:
As a rule, remember that:
Everything in the parent template is compiled in parent scope; everything in the child template is compiled in the child scope.Fallback Content
There are cases when it’s useful to specify fallback (i.e. default) content for a slot, to be rendered only when no content is provided. For example, in a <submit-button> component:
We might want the text “Submit” to be rendered inside the <button> most of the time. To make “Submit” the fallback content, we can place it in between the <slot> tags:
Now when we use <submit-button> in a parent component, providing no content for the slot:
will render the fallback content, “Submit”:
But if we provide content:
Then the provided content will be rendered instead:Named Slots
Updated in 2.6.0+. See here for the deprecated syntax using the slot attribute.
There are times when it’s useful to have multiple slots. For example, in a <base-layout> component with the following template:
For these cases, the <slot> element has a special attribute, name, which can be used to define additional slots:
A <slot> outlet without name implicitly has the name “default”.
To provide content to named slots, we can use the v-slot directive on a <template>, providing the name of the slot as v-slot‘s argument:
Now everything inside the <template> elements will be passed to the corresponding slots. Any content not wrapped in a <template> using v-slot is assumed to be for the default slot.
However, you can still wrap default slot content in a <template> if you wish to be explicit:
Either way, the rendered HTML will be: We poker app games.
Note that v-slot can only be added to a <template> (with one exception), unlike the deprecated slot attribute.Scoped Slots
Updated in 2.6.0+. See here for the deprecated syntax using the slot-scope attribute.
Sometimes, it’s useful for slot content to have access to data only available in the child component. For example, imagine a <current-user> component with the following template:
We might want to replace this fallback content to display the user’s first name, instead of last, like this:
That won’t work, however, because only the <current-user> component has access to the user and the content we’re providing is rendered in the parent.
To make user available to the slot content in the parent, we can bind user as an attribute to the <slot> element:
Attributes bound to a <slot> element are called slot props. Now, in the parent scope, we can use v-slot with a value to define a name for the slot props we’ve been provided:
Casino video poker games free. In this example, we’ve chosen to name the object containing all our slot props slotProps, but you can use any name you like.Abbreviated Syntax for Lone Default Slots
In cases like above, when only the default slot is provided content, the component’s tags can be used as the slot’s template. This allows us to use v-slot directly on the component:
This can be shortened even further. Just as non-specified content is assumed to be for the default slot, v-slot without an argument is assumed to refer to the default slot:
Note that the abbreviated syntax for default slot cannot be mixed with named slots, as it would lead to scope ambiguity:
Whenever there are multiple slots, use the full <template> based syntax for all slots:Destructuring Slot Props
Internally, scoped slots work by wrapping your slot content in a function passed a single argument:
That means the value of v-slot can actually accept any valid JavaScript expression that can appear in the argument position of a function definition. So in supported environments (single-file components or modern browsers), you can also use ES2015 destructuring to pull out specific slot props, like so:
This can make the template much cleaner, especially when the slot provides many props. It also opens other possibilities, such as renaming props, e.g. user to person:
You can even define fallbacks, to be used in case a slot prop is undefined:Dynamic Slot Names
New in 2.6.0+
Dynamic directive arguments also work on v-slot, allowing the definition of dynamic slot names:Named Slots Shorthand
New in 2.6.0+
Similar to v-on and v-bind, v-slot also has a shorthand, replacing everything before the argument (v-slot:) with the special symbol #. For example, v-slot:header can be rewritten as #header:
However, just as with other directives, the shorthand is only available when an argument is provided. That means the following syntax is invalid:
Instead, you must always specify the name of the slot if you wish to use the shorthand:Other Examples
Slot props allow us to turn slots into reusable templates that can render different content based on input props. This is most useful when you are designing a reusable component that encapsulates data logic while allowing the consuming parent component to customize part of its layout.
For example, we are implementing a <todo-list> component that contains the layout and filtering logic for a list:
Instead of hard-coding the content for each todo, we can let the parent component take control by making every todo a slot, then binding todo as a slot prop:
Now when we use the <todo-list> component, we can optionally define an alternative <template> for todo items, but with access to data from the child:
However, even this barely scratches the surface of what scoped slots are capable of. For real-life, powerful examples of scoped slot usage, we recommend browsing libraries such as Vue Virtual Scroller, Vue Promised, and Portal Vue.Deprecated Syntax
The v-slot directive was introduced in Vue 2.6.0, offering an improved, alternative API to the still-supported slot and slot-scope attributes. The full rationale for introducing v-slot is described in this RFC. The slot and slot-scope attributes will continue to be supported in all future 2.x releases, but are officially deprecated and will eventually be removed in Vue 3.Named Slots with the slot Attribute
Deprecated in 2.6.0+. See here for the new, recommended syntax.
To pass content to named slots from the parent, use the special slot attribute on <template> (using the <base-layout> component described here as example):
Or, the slot attribute can also be used directly on a normal element:
There can still be one unnamed slot, which is the default slot that serves as a catch-all for any unmatched content. In both examples above, the rendered HTML would be:Scoped Slots with the slot-scope Attribute
Deprecated in 2.6.0+. See here for the new, recommended syntax.
To receive props passed to a slot, the parent component can use <template> with the slot-scope attribute (using the <slot-example> described here as example):
Here, slot-scope declares the received props object as the slotProps variable, and makes it available inside the <template> scope. You can name slotProps anything you like similar to naming function arguments in JavaScript.
Here slot=’default’ can be omitted as it is implied:
The slot-scope attribute can also be used directly on a non-<template> element (including components):
The value of slot-scope can accept any valid JavaScript expression that can appear in the argument position of a function definition. This means in supported environments (single-file components or modern browsers) you can also use ES2015 destructuring in the expression, like so:
Using the <todo-list> described here as an example, here’s the equivalent usage using slot-scope:← Custom EventsDynamic & Async Components → Caught a mistake or want to contribute to the documentation? Edit this on GitHub! Deployed on Netlify . Time Slot 中文音標:[ slɔt ] 讀音:用’slot’造句’slot’怎麼讀’slot’的同義詞中文翻譯手機版
*
n.
1.狹縫,窄孔;【機械工程】漕溝;自動售貨機投錢口。
2.【航空】翼縫。
3.〔美口〕(集體或系列中的)位置,職位。
n.
(鹿等的)足跡,嗅跡。
vt.
跟著足跡追趕。
n.
〔英方〕門閂;〔方言〕條板。

*’slot no’ 中文翻譯: 集裝箱船積載圖
*’slot the’ 中文翻譯: 斯洛特海峽
*’slot-in’ 中文翻譯: 吸入式
*’t slot’ 中文翻譯: t 形槽; t形槽
*’t-slot t’ 中文翻譯: 形槽
*’access slot’ 中文翻譯: 存取口
*’aeration slot’ 中文翻譯: 摻氣槽
*’air slot’ 中文翻譯: 空氣槽
*’airfoil slot’ 中文翻譯: 翼縫
*’amalienborg slot’ 中文翻譯: 阿美琳堡宮; 琳堡宮
*’anchor slot’ 中文翻譯: 錨縫
*’annular slot’ 中文翻譯: 環狀縫隙
*’armature slot’ 中文翻譯: 電樞槽
*’athens slot’ 中文翻譯: 雅典古城堡
*’automatic slot’ 中文翻譯: 自動翼縫
*’axial slot’ 中文翻譯: 軸向隙縫
*’backplane slot’ 中文翻譯: 底板插槽
*’baseband slot’ 中文翻譯: 基帶間隔
*’bevelled slot’ 中文翻譯: 斜槽
*’blowing slot’ 中文翻譯: 噴氣縫口
*’bolts for t-slot’ 中文翻譯: 型槽用螺栓
*’bottom of slot’ 中文翻譯: 槽底
*’breaker slot’ 中文翻譯: 裝卸器上的槽
*’buffer slot’ 中文翻譯: 緩沖槽
*’slot (insulating) paper’ 中文翻譯: 電氣導線絕緣紙,線槽絕緣紙
*’slosson’ 中文翻譯: 斯洛森Time Slot 中文例句與用法
*He picked stemware from the slotted overhead .
他從頭上方櫥架上取下高腳餐具。
*The bolt slotted smoothly into place .
插銷很容易就插上了。
*Can we slot her into a job in the sales department ?
我們能把她安排在銷售部工作嗎?
*She now has her own parking slot on the catwalk level .
現在,她在過街層有自己的停車點。
*She placed her card in a slot on the outside the bank .
她在銀行外面把她的卡片塞進一條窄縫。
*She now has her own parking slot on the catwalk level .
現在,她在人行小道上有自己的停車點了。
*Slot this disk in .
把這張盤放進去。
*During fabrication slots for the stringers flanges were flame cut into box girders .
制造時,為安裝縱梁翼緣,在箱型梁中用焰割法開槽口。
*The compliance-calibration specimen has a slot of finite-tip radius in place of a crack .
柔度算定試樣是用一個有限端部半徑的槽來代替裂紋。
*The linkage from the diaphragm to the chock-valve lever rides freely in a slot in the lever .
由膜片到阻風門擺臂的連桿可在擺臂內的槽中自由活動。
*更多例句: 1 2345用’slot’造句英文解釋
*a small slit (as for inserting a coin or depositing mail); ’he put a quarter in the slot’

*a slot machine that is used for gambling; ’they spend hours and hours just playing the slots’
同義詞:one-armed bandit,

*(computer) a socket in a microcomputer that will accept a plug-in circuit board; ’the PC had three slots for additional memory’
同義詞:expansion slot,

*a position in a grammatical linguistic construction in which a variety of alternative units are interchangeable; ’he developed a version of slot grammar’

*the trail of an animal (especially a deer); ’he followed the deer’s slot over the soft turf to the edge of the trees’

*a position in a hierarchy or organization; ’Bob Dylan occupied the top slot for several weeks’; ’she beat some tough competition for the number one slot’

*a time assigned on a schedule or agenda; ’the TV program has a new time slot’; ’an aircraft landing slot’
同義詞:time slot,

*assign a time slot; ’slot a television program’
其他語言Slot 中文
*slotとは意味:1slot n. (自動販売機 公衆電話などの)料金投入口; 細い隙間.【動詞+】◆We have yet to find a good activity with which to fill this 45-minute time slot. これからこの 45 分の空き時間を埋める適當な活動を見つけなくてはならない◆find a slot in one’s schedule (何かを割りこませ..相關詞匯Slot 翻译slot television 中文, slot man 中文, time slot 中文, slot aerial 中文, slot machine 中文, slot car 中文, slossitis medicamentosa 中文, slossitis rhomboidea mediana 中文, slossitis sclerotica 中文, slossitis venenata 中文, slosson 中文, slot (insulating) paper 中文, slot aileron 中文, slot allow for prewrapping of bundless 中文, slot and crank 中文, slot的中文翻譯,slot是什麼意思,怎麽用漢語翻譯slot,slot的中文意思,slot的中文,slot in Chinese,slot怎麼讀,发音,例句,用法和解釋由查查在綫詞典提供,版權所有違者必究。
Register here: http://gg.gg/uizmf

https://diarynote-jp.indered.space

コメント

最新の日記 一覧

<<  2025年6月  >>
1234567
891011121314
15161718192021
22232425262728
293012345

お気に入り日記の更新

テーマ別日記一覧

まだテーマがありません

この日記について

日記内を検索