|
@@ -1,8 +1,8 @@
|
|
|
import { useEditor } from "@/modules/editor";
|
|
|
-import { css, cx } from "@linaria/core";
|
|
|
+import { css } from "@linaria/core";
|
|
|
import { watch } from "vue";
|
|
|
import { string } from "vue-types";
|
|
|
-import { useCompData } from ".";
|
|
|
+import { useCompData, useCreateChild } from ".";
|
|
|
import { Text } from "../../../basicUI";
|
|
|
import { createUIComp } from "../../../defines/createUIComp";
|
|
|
|
|
@@ -12,17 +12,17 @@ export const Component = createUIComp({
|
|
|
},
|
|
|
setup(props) {
|
|
|
const { helper } = useEditor();
|
|
|
- const { value } = useCompData(props.compId);
|
|
|
+ const { value, children } = useCompData(props.compId);
|
|
|
+ const createList = useCreateChild("list", props.compId);
|
|
|
|
|
|
watch(
|
|
|
() => [value.columns],
|
|
|
() => {
|
|
|
- const { columns, list } = value;
|
|
|
+ const { columns } = value;
|
|
|
+ const { list } = children;
|
|
|
const offset = columns - list.length;
|
|
|
if (offset > 0) {
|
|
|
- Array.from({ length: offset }, () => {
|
|
|
- list.push({ label: "标题", content: "内容" });
|
|
|
- });
|
|
|
+ children.list.push(...createList(offset));
|
|
|
} else {
|
|
|
list.splice(columns, offset * -1);
|
|
|
}
|
|
@@ -31,31 +31,25 @@ export const Component = createUIComp({
|
|
|
|
|
|
return () => (
|
|
|
<div class={rootStyles}>
|
|
|
- {value.list.map((d) => (
|
|
|
+ {children.list.map((d) => (
|
|
|
<div
|
|
|
class="flex items-center text-primary px-0.1rem"
|
|
|
style={{
|
|
|
margin: helper.designToNaturalSize(value.gap),
|
|
|
}}
|
|
|
>
|
|
|
- <div
|
|
|
- class={cx(
|
|
|
- "py-0.08rem px-0.1rem",
|
|
|
- value.showBackground ? "label text-white" : "text-secondary"
|
|
|
- )}
|
|
|
+ <Text.Component
|
|
|
+ compId={d.label}
|
|
|
+ class={
|
|
|
+ value.showBackground
|
|
|
+ ? "text relative z-1 py-0.08rem px-0.1rem text-white"
|
|
|
+ : "text-secondary"
|
|
|
+ }
|
|
|
style={{
|
|
|
width: helper.designToNaturalSize(value.width),
|
|
|
}}
|
|
|
- >
|
|
|
- <Text.Component
|
|
|
- v-model={[d.label, "value"]}
|
|
|
- class="text text-center"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <Text.Component
|
|
|
- v-model={[d.content, "value"]}
|
|
|
- class="flex-1 ml-0.3rem"
|
|
|
/>
|
|
|
+ <Text.Component compId={d.content} class="flex-1 ml-0.3rem" />
|
|
|
</div>
|
|
|
))}
|
|
|
</div>
|
|
@@ -64,13 +58,7 @@ export const Component = createUIComp({
|
|
|
});
|
|
|
|
|
|
const rootStyles = css`
|
|
|
- .label {
|
|
|
- position: relative;
|
|
|
- z-index: 1;
|
|
|
- .text {
|
|
|
- position: relative;
|
|
|
- z-index: 1;
|
|
|
- }
|
|
|
+ .text {
|
|
|
&::before {
|
|
|
content: "";
|
|
|
position: absolute;
|
|
@@ -79,8 +67,8 @@ const rootStyles = css`
|
|
|
width: 92%;
|
|
|
height: 100%;
|
|
|
background-color: #333;
|
|
|
- transform: skewX(347deg);
|
|
|
- z-index: 0;
|
|
|
+ transform: skewX(345deg);
|
|
|
+ z-index: -1;
|
|
|
}
|
|
|
}
|
|
|
`;
|