久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      vue內(nèi)置組件有哪些

      vue組件有:1、component,用于渲染一個“元組件”為動態(tài)組件。2、transition,用于為單個元素或組件提供動畫過渡效果。3、transition-group,用于為列表中的多個元素或組件提供過渡效果。4、keep-alive,用于緩存包裹在其中的動態(tài)切換組件。5、slot。6、teleport,用于將其插槽內(nèi)容渲染到DOM中的另一個位置。7、Suspense。

      vue內(nèi)置組件有哪些

      本教程操作環(huán)境:windows7系統(tǒng)、vue3版,DELL G3電腦。

      內(nèi)置組件無需注冊便可以直接在模板中使用。它們也是 tree-shakeable 的:僅在使用時才會包含在構(gòu)建中。

      在渲染函數(shù)中使用它們時,需要顯式導(dǎo)入。例如:

      import { h, Transition } from 'vue'  h(Transition, {   /* props */ })
      登錄后復(fù)制

      1、component

      • Props:

        isstring | Component

      • 用法:

      渲染一個“元組件”為動態(tài)組件。依 is 的值,來決定哪個組件被渲染。is 的值是一個字符串,它既可以是 HTML 標簽名稱也可以是組件名稱。

        <!--  動態(tài)組件由 vm 實例的 `componentId` property 控制 -->   <component :is="componentId"></component>      <!-- 也能夠渲染注冊過的組件或 prop 傳入的組件-->   <component :is="$options.components.child"></component>      <!-- 可以通過字符串引用組件 -->   <component :is="condition ? 'FooComponent' : 'BarComponent'"></component>      <!-- 可以用來渲染原生 HTML 元素 -->   <component :is="href ? 'a' : 'span'"></component>
      登錄后復(fù)制

      2、transition

      • Props:

        namestring 用于自動生成 CSS 過渡類名。例如:name: 'fade' 將自動拓展為 .fade-enter,.fade-enter-active 等。

        appearboolean,是否在初始渲染時使用過渡。默認為 false。

        persistedboolean。如果是 true,表示這是一個不真實插入/刪除元素的轉(zhuǎn)換,而是切換顯示/隱藏狀態(tài)。過渡鉤子被注入,但渲染器將跳過。相反,自定義指令可以通過調(diào)用注入的鉤子 (例如 v-show) 來控制轉(zhuǎn)換。

        cssboolean。是否使用 CSS 過渡類。默認為 true。如果設(shè)置為 false,將只通過組件事件觸發(fā)注冊的 JavaScript 鉤子。

        typestring。指定過渡事件類型,偵聽過渡何時結(jié)束。有效值為 "transition""animation"。默認 Vue.js 將自動檢測出持續(xù)時間長的為過渡事件類型。

        modestring 控制離開/進入過渡的時間序列。有效的模式有 "out-in""in-out";默認同時進行。

        durationnumber | { enter : number, leave : number }。指定過渡的持續(xù)時間。默認情況下,Vue 會等待過渡所在根元素的第一個 transitionendanimationend 事件。

        enter-from-classstring

        leave-from-classstring

        appear-classstring

        enter-to-classstring

        leave-to-classstring

        appear-to-classstring

        enter-active-classstring

        leave-active-classstring

        appear-active-classstring

      • 事件:

        before-enter

        before-leave

        enter

        leave

        appear

        after-enter

        after-leave

        after-appear

        enter-cancelled

        leave-cancelled (僅 v-show)

        appear-cancelled

      • 用法:

      <transition> 元素作為單個元素/組件的過渡效果。<transition> 只會把過渡效果應(yīng)用到其包裹的內(nèi)容上,而不會額外渲染 DOM 元素,也不會出現(xiàn)在可被檢查的組件層級中。

        <!--  動態(tài)組件由 vm 實例的 `componentId` property 控制 -->   <component :is="componentId"></component>      <!-- 也能夠渲染注冊過的組件或 prop 傳入的組件-->   <component :is="$options.components.child"></component>      <!-- 可以通過字符串引用組件 -->   <component :is="condition ? 'FooComponent' : 'BarComponent'"></component>      <!-- 可以用來渲染原生 HTML 元素 -->   <component :is="href ? 'a' : 'span'"></component>
      登錄后復(fù)制

        const app = Vue.createApp({     ...     methods: {       transitionComplete (el) {         // 因為傳遞了'el'的DOM元素作為參數(shù)       }     }     ...   })      app.mount('#transition-demo')
      登錄后復(fù)制

      3、transition-group

      • Props:

        tagstring,默認為 span。

        move-class – 覆蓋移動過渡期間應(yīng)用的 CSS 類。

        除了 mode,其他 attribute 和 <transition> 相同。

      • 事件:

        事件和 <transition> 相同。

      • 用法:

      <transition-group> 元素作為多個元素/組件的過渡效果。<transition-group> 渲染一個真實的 DOM 元素。默認渲染 <span>,可以通過 tag attribute 配置哪個元素應(yīng)該被渲染。

      注意,每個 <transition-group> 的子節(jié)點必須有獨立的 key,動畫才能正常工作

      <transition-group> 支持通過 CSS transform 過渡移動。當一個子節(jié)點被更新,從屏幕上的位置發(fā)生變化,它會被應(yīng)用一個移動中的 CSS 類 (通過 name attribute 或配置 move-class attribute 自動生成)。如果 CSS transform property 是“可過渡”property,當應(yīng)用移動類時,將會使用 FLIP 技術(shù)使元素流暢地到達動畫終點。

        <transition-group tag="ul" name="slide">     <li v-for="item in items" :key="item.id">       {{ item.text }}     </li>   </transition-group>
      登錄后復(fù)制

      4、keep-alive

      • Props:

        includestring | RegExp | Array。只有名稱匹配的組件會被緩存。

        excludestring | RegExp | Array。任何名稱匹配的組件都不會被緩存。

        maxnumber | string。最多可以緩存多少組件實例。

      • 用法:

      <keep-alive> 包裹動態(tài)組件時,會緩存不活動的組件實例,而不是銷毀它們。和 <transition> 相似,<keep-alive> 是一個抽象組件:它自身不會渲染一個 DOM 元素,也不會出現(xiàn)在組件的父組件鏈中。

      當組件在 <keep-alive> 內(nèi)被切換,它的 activateddeactivated 這兩個生命周期鉤子函數(shù)將會被對應(yīng)執(zhí)行。

      主要用于保留組件狀態(tài)或避免重新渲染。

        <!-- 基本 -->   <keep-alive>     <component :is="view"></component>   </keep-alive>      <!-- 多個條件判斷的子組件 -->   <keep-alive>     <comp-a v-if="a > 1"></comp-a>     <comp-b v-else></comp-b>   </keep-alive>      <!-- 和 `<transition>` 一起使用 -->   <transition>     <keep-alive>       <component :is="view"></component>     </keep-alive>   </transition>
      登錄后復(fù)制

      注意,<keep-alive> 是用在其一個直屬的子組件被切換的情形。如果你在其中有 v-for 則不會工作。如果有上述的多個條件性的子元素,<keep-alive> 要求同時只有一個子元素被渲染。

      • includeexclude

      The includeexclude prop 允許組件有條件地緩存。二者都可以用逗號分隔字符串、正則表達式或一個數(shù)組來表示:

        <!-- 逗號分隔字符串 -->   <keep-alive include="a,b">     <component :is="view"></component>   </keep-alive>      <!-- regex (使用 `v-bind`) -->   <keep-alive :include="/a|b/">     <component :is="view"></component>   </keep-alive>      <!-- Array (使用 `v-bind`) -->   <keep-alive :include="['a', 'b']">     <component :is="view"></component>   </keep-alive>
      登錄后復(fù)制

      匹配首先檢查組件自身的 name 選項,如果 name 選項不可用,則匹配它的局部注冊名稱 (父組件 components 選項的鍵值)。匿名組件不能被匹配。

      • max

      最多可以緩存多少組件實例。一旦這個數(shù)字達到了,在新實例被創(chuàng)建之前,已緩存組件中最久沒有被訪問的實例會被銷毀掉。

        <keep-alive :max="10">     <component :is="view"></component>   </keep-alive>
      登錄后復(fù)制

      <keep-alive> 不會在函數(shù)式組件中正常工作,因為它們沒有緩存實例。

      5、slot

      • Props:

        namestring,用于具名插槽

      • 用法:

      <slot> 元素作為組件模板之中的內(nèi)容分發(fā)插槽。<slot> 元素自身將被替換。

      6、teleport

      • Props:

      tostring。需要 prop,必須是有效的查詢選擇器或 HTMLElement (如果在瀏覽器環(huán)境中使用)。指定將在其中移動 <teleport> 內(nèi)容的目標元素

        <!-- 正確 -->   <teleport to="#some-id" />   <teleport to=".some-class" />   <teleport to="[data-teleport]" />      <!-- 錯誤 -->   <teleport to="h1" />   <teleport to="some-string" />
      登錄后復(fù)制

      disabledboolean。此可選屬性可用于禁用 <teleport> 的功能,這意味著其插槽內(nèi)容將不會移動到任何位置,而是在您在周圍父組件中指定了 <teleport> 的位置渲染。

        <teleport to="#popup" :disabled="displayVideoInline">     <video src="./my-movie.mp4">   </teleport>
      登錄后復(fù)制

      請注意,這將移動實際的 DOM 節(jié)點,而不是被銷毀和重新創(chuàng)建,并且它還將保持任何組件實例的活動狀態(tài)。所有有狀態(tài)的 HTML 元素 (即播放的視頻) 都將保持其狀態(tài)。

      7、Suspense

      用于協(xié)調(diào)對組件樹中嵌套的異步依賴的處理。

      • Props

      interface SuspenseProps {   timeout?: string | number }
      登錄后復(fù)制

      • 事件

        @resolve

        @pending

        @fallback

      • 詳細信息

      <Suspense> 接受兩個插槽:#default 和 #fallback。它將在內(nèi)存中渲染默認插槽的同時展示后備插槽內(nèi)容。

      如果在渲染時遇到異步依賴項 (異步組件和具有 async setup() 的組件),它將等到所有異步依賴項解析完成時再顯示默認插槽。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號