plain-design 1.0.0-beta.12 → 1.0.0-beta.14

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.14",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -1,12 +1,14 @@
1
- import {designComponent, mergeAttrs, nextTick, PropType, reactive, useStyles, watch} from "plain-design-composition";
1
+ import {designComponent, mergeAttrs, nextTick, PropType, reactive, RenderNode, useStyles, watch} from "plain-design-composition";
2
2
  import {PlTabComponent} from "../Tab";
3
3
 
4
4
  export const TabsInner = designComponent({
5
5
  props: {
6
6
  item: { type: Object as PropType<PlTabComponent>, required: true },
7
7
  active: { type: Boolean },
8
+ render: { type: Function as PropType<() => RenderNode>, required: true }
8
9
  },
9
- setup({ props }) {
10
+ slots: ['default'],
11
+ setup({ props, slots }) {
10
12
 
11
13
  const state = reactive({
12
14
  show: false,
@@ -50,7 +52,7 @@ export const TabsInner = designComponent({
50
52
  { class: 'inner-tab', style: styles.value },
51
53
  props.item.attrs
52
54
  )}>
53
- {!!state.init && props.item.slots.default()}
55
+ {!!state.init && props.render()}
54
56
  </div>
55
57
  )
56
58
  };
@@ -101,7 +101,7 @@ export const TabGroup = designComponent({
101
101
  const body = (
102
102
  <div className="tabs-body">
103
103
  {[...tabs.value].sort((a, b) => String(a.val).localeCompare(String(b.val))).map((tab, index) => (
104
- <TabsInner item={tab.item} key={index} active={tab.active}/>
104
+ <TabsInner item={tab.item} key={index} active={tab.active} render={() => tab.item.slots.default()}/>
105
105
  ))}
106
106
  </div>
107
107
  );
@@ -313,23 +313,23 @@ export const demoInit = designPage(() => {
313
313
  <Tab title="用户管理" style={{ padding: '20px 0' }}>
314
314
  <span>用户管理:</span>
315
315
  <Input
316
- onMounted={() => console.log('用户管理 mouinted',)}
317
- onBeforeMount={() => console.log('用户管理 unmount',)}
316
+ onMounted={() => console.log('用户管理 mounted',)}
317
+ onUnmounted={() => console.log('用户管理 unmount',)}
318
318
  />
319
319
  </Tab>
320
320
  <Tab title="立即初始化" style={{ padding: '20px 0' }} init>
321
321
  <span>子模块数据管理:</span>
322
322
  <Input
323
- onMounted={() => console.log('立即初始化 mouinted',)}
324
- onBeforeMount={() => console.log('立即初始化 unmount',)}
323
+ onMounted={() => console.log('立即初始化 mounted',)}
324
+ onUnmounted={() => console.log('立即初始化 unmount',)}
325
325
  />
326
326
  </Tab>
327
327
  <Tab title="关闭的时候销毁" style={{ padding: '20px 0' }} destroyOnHide>
328
328
  <span>数据集:</span>
329
329
  <Input
330
330
  modelValue={'初始值'}
331
- onMounted={() => console.log('关闭的时候销毁 mouinted',)}
332
- onBeforeMount={() => console.log('关闭的时候销毁 unmount',)}
331
+ onMounted={() => console.log('关闭的时候销毁 mounted',)}
332
+ onUnmounted={() => console.log('关闭的时候销毁 unmount',)}
333
333
  />
334
334
  </Tab>
335
335
  </TabGroup>