diff --git a/api-generator/components/accordion.js b/api-generator/components/accordion.js index dc5595d59..9f136887c 100644 --- a/api-generator/components/accordion.js +++ b/api-generator/components/accordion.js @@ -10,6 +10,12 @@ const AccordionProps = [ type: "number|array", default: "null", description: "Index of the active tab or an array of indexes in multiple mode." + }, + { + name: "lazy", + type: "boolean", + default: "false", + description: "When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css." } ]; diff --git a/api-generator/components/tabview.js b/api-generator/components/tabview.js index 901a3e189..b04ca2267 100644 --- a/api-generator/components/tabview.js +++ b/api-generator/components/tabview.js @@ -4,6 +4,12 @@ const TabViewProps = [ type: "number", default: "0", description: "Index of the active tab." + }, + { + name: "lazy", + type: "boolean", + default: "false", + description: "When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css." } ]; diff --git a/src/components/accordion/Accordion.vue b/src/components/accordion/Accordion.vue index f4d4d0b3d..d429df16a 100755 --- a/src/components/accordion/Accordion.vue +++ b/src/components/accordion/Accordion.vue @@ -10,7 +10,7 @@ -
@@ -28,8 +28,18 @@ export default { name: 'Accordion', emits: ['tab-close', 'tab-open', 'update:activeIndex'], props: { - multiple: Boolean, - activeIndex: [Number,Array] + multiple: { + type: Boolean, + default: false + }, + activeIndex: { + type: [Number,Array], + default: null + }, + lazy: { + type: Boolean, + default: false + } }, data() { return { diff --git a/src/components/tabview/TabView.vue b/src/components/tabview/TabView.vue index cd0276b82..b9a743a9d 100755 --- a/src/components/tabview/TabView.vue +++ b/src/components/tabview/TabView.vue @@ -10,9 +10,11 @@
  • -
    - -
    +
    @@ -28,6 +30,10 @@ export default { activeIndex: { type: Number, default: 0 + }, + lazy: { + type: Boolean, + default: false } }, data() { diff --git a/src/views/accordion/AccordionDoc.vue b/src/views/accordion/AccordionDoc.vue index 78af0c644..97870a47d 100755 --- a/src/views/accordion/AccordionDoc.vue +++ b/src/views/accordion/AccordionDoc.vue @@ -177,6 +177,25 @@ export default { } } + + +
    Lazy Rendering
    +

    All tabs are rendered when mounted and inactive tabs are hidden with CSS. Enabling lazy option activates the dynamic mode where a tab is only rendered at DOM when it is active. This option is + useful to speed up the initial rendering performance if there are many tabs.

    + +
    
    +<Accordion lazy>
    +	<AccordionTab header="Header I">
    +		Content
    +	</AccordionTab>
    +	<AccordionTab header="Header II">
    +		Content
    +	</AccordionTab>
    +	<AccordionTab header="Header III">
    +		Content
    +	</AccordionTab>
    +</Accordion>
    +
     
    Properties of AccordionTab
    @@ -237,6 +256,12 @@ export default { number|array null Index of the active tab or an array of indexes in multiple mode. + + + lazy + boolean + false + When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css. diff --git a/src/views/tabview/TabViewDoc.vue b/src/views/tabview/TabViewDoc.vue index 2a7604e9e..fa40bde38 100755 --- a/src/views/tabview/TabViewDoc.vue +++ b/src/views/tabview/TabViewDoc.vue @@ -152,6 +152,25 @@ export default { } } + + +
    Lazy Rendering
    +

    All tabs are rendered when mounted and inactive tabs are hidden with CSS. Enabling lazy option activates the dynamic mode where a tab is only rendered at DOM when it is active. This option is + useful to speed up the initial rendering performance if there are many tabs.

    + +
    
    +<TabView lazy>
    +	<TabPanel header="Header I">
    +		Content I
    +	</TabPanel>
    +	<TabPanel header="Header II">
    +		Content II
    +	</TabPanel>
    +	<TabPanel header="Header III">
    +		Content III
    +	</TabPanel>
    +</TabView>
    +
     
    Properties of TabPanel
    @@ -200,6 +219,12 @@ export default { number 0 Index of the active tab. + + + lazy + boolean + false + When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css.