fix:调整组件和页面scheme的类型

This commit is contained in:
lhj
2024-11-17 15:29:52 +08:00
parent f601417913
commit 2e1d590c89
11 changed files with 69 additions and 78 deletions

View File

@ -1,27 +1,40 @@
<template> <template>
<div style="overflow-y: scroll"> <div :style="headerStyle">
<div style="width: 100%;"> <div style="width: 100%;">
<slot name="header"></slot> <slot name="header"></slot>
</div>
<div style="width: 100%;height: 100%;background-color: #f7f8fa;">
<slot>
MAIN
</slot>
</div>
<div style="width: 100%;">
<slot name="footer"></slot>
</div>
</div> </div>
<div style="width: 100%;height: 100%;background-color: #f7f8fa;">
MAIN
<slot>
</slot>
</div>
<div style="width: 100%;">
<slot name="footer"></slot>
</div>
</div>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import {ref} from 'vue';
const dataSources = ref({}) const dataSources = ref({})
onMounted(()=> const headerStyle = ref({});
{
const fitRect = function () {
const containerEl = document.getElementById('renderArea');
if (!containerEl) return;
const containerRect = containerEl.getBoundingClientRect();
headerStyle.value = {
overflowY: scroll,
width: `${containerRect.width}px`,
height: `${containerRect.height}px`,
};
}
onMounted(() => {
fitRect();
}) })
</script> </script>

View File

@ -1,35 +1,15 @@
[ [
{ {
"id": "Card-b22544833910000", "id": "AdaptivePage-4e510f833910000",
"name": "card", "name": "AdaptivePage",
"type": "Card", "type": "AdaptivePage",
"props": { "props": {},
"title": "Card" "class": "",
},
"class": "arco-card arco-card-size-medium arco-card-bordered",
"designer": "", "designer": "",
"text": "ByteDance's core product, Toutiao (\"Headlines\"), is a content platform in China and around the world. Toutiao started out as a news recommendation engine and gradually evolved into a platform delivering content in various formats.",
"children": [], "children": [],
"style": "width:360px", "style": "",
"visible": true, "visible": true,
"slots": { "slots": {},
"extra": {
"id": "9f8289a12910000",
"name": "avatar",
"type": "Avatar",
"props": {},
"class": "",
"designer": "",
"text": "",
"children": [],
"style": "",
"visible": "",
"slots": {},
"disable": "",
"events": {},
"loop": {}
}
},
"disable": true, "disable": true,
"events": {}, "events": {},
"loop": {} "loop": {}

View File

@ -12,10 +12,11 @@
"orchestrations": {}, "orchestrations": {},
"events": {}, "events": {},
"slots": {}, "slots": {},
"header": {}, "header": [],
"footer": {}, "footer": [],
"children": [], "body": [],
"meta": {}, "meta": {},
"visible": true, "visible": true,
"disable": false "disable": false,
"designer": {}
} }

View File

@ -13,9 +13,9 @@
"orchestrations": {}, "orchestrations": {},
"events": {}, "events": {},
"slots": {}, "slots": {},
"header": {}, "header": [],
"footer": {}, "footer": [],
"children": [], "body": [],
"meta": {}, "meta": {},
"visible": true, "visible": true,
"disable": false "disable": false

View File

@ -13,9 +13,9 @@ export const componentScheme = {
"orchestrations": {}, "orchestrations": {},
"events": {}, "events": {},
"slots": {}, "slots": {},
"header": {}, "header": [],
"footer": {}, "footer": [],
"children": [], "body": [],
"meta": {}, "meta": {},
"visible": true, "visible": true,
"disable": false "disable": false

View File

@ -1,2 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -3,7 +3,7 @@ export interface IComponent {
name: string; name: string;
id: string; id: string;
text:string; text:string;
designer: string; designer: JSON;
props: JSON; props: JSON;
style: string; style: string;
class: string; class: string;

View File

@ -3,10 +3,10 @@ import { IComponent } from "./IComponent";
export interface IPageComponent extends IComponent export interface IPageComponent extends IComponent
{ {
variables:JSON; variables:JSON;
dataSources:JSON; dataSources:[];
functions:JSON; functions:JSON;
header:JSON; header:IComponent[];
footer:JSON; footer:IComponent[];
meta:JSON; meta:JSON;
children: IPageComponent[]; body:IComponent[];
} }

View File

@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
var __generator = (this && this.__generator) || function (thisArg, body) { var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; } function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) { function step(op) {
if (f) throw new TypeError("Generator is already executing."); if (f) throw new TypeError("Generator is already executing.");
@ -118,8 +118,7 @@ function writeModifiedComponents(components) {
case 3: case 3:
if (!(_i < components_1.length)) return [3 /*break*/, 6]; if (!(_i < components_1.length)) return [3 /*break*/, 6];
component = components_1[_i]; component = components_1[_i];
updatedComponent = __assign(__assign({}, component), { visible: true, disable: false // 统一设置 disable 为 false updatedComponent = __assign(__assign({}, component), { visible: true, disable: false, designer: {} });
});
fileName = "".concat(component.type, ".json"); fileName = "".concat(component.type, ".json");
filePath = path.join(exportModifiedComponentsDir, fileName); filePath = path.join(exportModifiedComponentsDir, fileName);
content = JSON.stringify(updatedComponent, null, 2); content = JSON.stringify(updatedComponent, null, 2);

View File

@ -50,7 +50,8 @@ async function writeModifiedComponents(components: IComponent[]): Promise<void>
const updatedComponent = { const updatedComponent = {
...component, ...component,
visible: true, // 统一设置 visible 为 true visible: true, // 统一设置 visible 为 true
disable: false // 统一设置 disable 为 false disable: false, // 统一设置 disable 为 false
designer:{},
}; };
const fileName = `${component.type}.json`; const fileName = `${component.type}.json`;

View File

@ -118,17 +118,17 @@ store.$onAction(
// 初始化scheme // 初始化scheme
const initScheme = async () => { const initScheme = async () => {
// try { try {
// const response = await axios.get('http://localhost:3000/load'); const response = await axios.get('http://localhost:3000/load');
// if (response.data && Array.isArray(response.data)) { if (response.data && Array.isArray(response.data)) {
// store.initPreviewScheme(response.data); store.initPreviewScheme(response.data);
// } else { } else {
// store.initPreviewScheme([baseScheme]); store.initPreviewScheme([baseScheme]);
// } }
// } catch (error) { } catch (error) {
// console.error('Error loading data:', error); console.error('Error loading data:', error);
// store.initPreviewScheme([baseScheme]); store.initPreviewScheme([baseScheme]);
// } }
componentsList = Object.values(componentScheme); componentsList = Object.values(componentScheme);
store.initComponents(componentsList); store.initComponents(componentsList);
}; };
@ -270,7 +270,6 @@ const view = () => {
background-color: #fff; background-color: #fff;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow-y: auto; /* 确保当内容超出时,出现垂直滚动条 */
} }
.ghost { .ghost {