|
@@ -1,6 +1,6 @@
|
|
|
import { watch } from "vue";
|
|
|
import { string } from "vue-types";
|
|
|
-import { useChildCreator, useCompData } from ".";
|
|
|
+import { useCompData, useCreateChild } from ".";
|
|
|
import { useEditor } from "../../../../..";
|
|
|
import { Image, Text } from "../../../basicUI";
|
|
|
import { createUIComp } from "../../../defines/createUIComp";
|
|
@@ -12,20 +12,20 @@ export const Component = createUIComp({
|
|
|
setup(props) {
|
|
|
const { helper } = useEditor();
|
|
|
const { value, children } = useCompData(props.compId);
|
|
|
- // const createList = useChildCreator("list");
|
|
|
+ const createList = useCreateChild("list");
|
|
|
|
|
|
- // watch(
|
|
|
- // () => [value.total],
|
|
|
- // () => {
|
|
|
- // const { total } = value;
|
|
|
- // const offset = total - children.list.length;
|
|
|
- // if (offset > 0) {
|
|
|
- // children.list.push(...createList(offset));
|
|
|
- // } else {
|
|
|
- // children.list.splice(total, offset * -1);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // );
|
|
|
+ watch(
|
|
|
+ () => [value.total],
|
|
|
+ () => {
|
|
|
+ const { total } = value;
|
|
|
+ const offset = total - children.list.length;
|
|
|
+ if (offset > 0) {
|
|
|
+ children.list.push(...createList(offset));
|
|
|
+ } else {
|
|
|
+ children.list.splice(total, offset * -1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
return () => (
|
|
|
<div
|