diff --git a/src/js/components/navigation/KLTabs/KLTab/index.html b/src/js/components/navigation/KLTabs/KLTab/index.html new file mode 100644 index 00000000..5078550c --- /dev/null +++ b/src/js/components/navigation/KLTabs/KLTab/index.html @@ -0,0 +1,7 @@ +{#if this.$outer.data.fresh} +{#if this.$outer.data.selected === this} +
{#inc this.$body}
+{/if} +{#else} +
{#inc this.$body}
+{/if} \ No newline at end of file diff --git a/src/js/components/navigation/KLTabs/KLTab/index.js b/src/js/components/navigation/KLTabs/KLTab/index.js index d19d502b..8ffcd6d1 100644 --- a/src/js/components/navigation/KLTabs/KLTab/index.js +++ b/src/js/components/navigation/KLTabs/KLTab/index.js @@ -6,6 +6,7 @@ const Component = require('../../../../ui-base/component'); const _ = require('../../../../ui-base/_'); +const template = require('./index.html'); const KLTabs = require('../index'); /** @@ -17,8 +18,7 @@ const KLTabs = require('../index'); */ const KLTab = Component.extend({ name: 'kl-tab', - template: - '
{#inc this.$body}
', + template, /** * @protected */ diff --git a/src/js/components/navigation/KLTabs/index.js b/src/js/components/navigation/KLTabs/index.js index 790ed63d..1a6d25ee 100644 --- a/src/js/components/navigation/KLTabs/index.js +++ b/src/js/components/navigation/KLTabs/index.js @@ -24,6 +24,7 @@ const _ = require('../../../ui-base/_'); * @param {object} [options.data.selected=null] <=> 当前选择卡 * @param {string} [options.data.titleTemplate=null] @=> 标题模板 * @param {string} [options.data.defaultKey=null] => 默认显示对应 key 的 Tab + * @param {boolean} [options.data.refresh=false] => 切换 Tab 是否重新渲染 * @param {boolean} [options.data.readonly=false] => 是否只读 * @param {boolean} [options.data.disabled=false] => 是否禁用 * @param {boolean} [options.data.visible=true] => 是否显示 diff --git a/src/js/components/navigation/KLTabs/index.md b/src/js/components/navigation/KLTabs/index.md index 0b8843bf..b35b015b 100644 --- a/src/js/components/navigation/KLTabs/index.md +++ b/src/js/components/navigation/KLTabs/index.md @@ -14,7 +14,22 @@ title: 选项卡 Content1 Content2 Content3 - Content4 + + +``` + + +### 每次切换 Tab 时重新渲染 + + +
+ +```xml + + Content1 + Content2 + Content3 + ```