添加页面组件、添加页面组件接口、添加pinia
This commit is contained in:
1
components.d.ts
vendored
1
components.d.ts
vendored
@ -7,6 +7,7 @@ export {}
|
|||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
|
AdaptivePage: typeof import('./src/components/AdaptivePage.vue')['default']
|
||||||
DynamicComponent: typeof import('./src/components/DynamicComponent.vue')['default']
|
DynamicComponent: typeof import('./src/components/DynamicComponent.vue')['default']
|
||||||
ElTable: typeof import('./src/components/ElTable.vue')['default']
|
ElTable: typeof import('./src/components/ElTable.vue')['default']
|
||||||
MainView: typeof import('./src/components/MainView.vue')['default']
|
MainView: typeof import('./src/components/MainView.vue')['default']
|
||||||
|
|||||||
56
package-lock.json
generated
56
package-lock.json
generated
@ -13,6 +13,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lsp-uuid": "^3.2.0",
|
"lsp-uuid": "^3.2.0",
|
||||||
|
"pinia": "^2.2.4",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"vue": "^3.2.25",
|
"vue": "^3.2.25",
|
||||||
"vue-draggable-plus": "^0.5.3"
|
"vue-draggable-plus": "^0.5.3"
|
||||||
@ -1164,6 +1165,11 @@
|
|||||||
"he": "^1.2.0"
|
"he": "^1.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@vue/devtools-api": {
|
||||||
|
"version": "6.6.4",
|
||||||
|
"resolved": "https://repo.bingosoft.net/repository/npm/@vue/devtools-api/-/devtools-api-6.6.4.tgz",
|
||||||
|
"integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g=="
|
||||||
|
},
|
||||||
"node_modules/@vue/language-core": {
|
"node_modules/@vue/language-core": {
|
||||||
"version": "2.0.29",
|
"version": "2.0.29",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/language-core/-/language-core-2.0.29.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/language-core/-/language-core-2.0.29.tgz",
|
||||||
@ -2646,6 +2652,56 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pinia": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://repo.bingosoft.net/repository/npm/pinia/-/pinia-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-K7ZhpMY9iJ9ShTC0cR2+PnxdQRuwVIsXDO/WIEV/RnMC/vmSoKDTKW/exNQYPI+4ij10UjXqdNiEHwn47McANQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@vue/devtools-api": "^6.6.3",
|
||||||
|
"vue-demi": "^0.14.10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/posva"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@vue/composition-api": "^1.4.0",
|
||||||
|
"typescript": ">=4.4.4",
|
||||||
|
"vue": "^2.6.14 || ^3.3.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@vue/composition-api": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pinia/node_modules/vue-demi": {
|
||||||
|
"version": "0.14.10",
|
||||||
|
"resolved": "https://repo.bingosoft.net/repository/npm/vue-demi/-/vue-demi-0.14.10.tgz",
|
||||||
|
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"bin": {
|
||||||
|
"vue-demi-fix": "bin/vue-demi-fix.js",
|
||||||
|
"vue-demi-switch": "bin/vue-demi-switch.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/antfu"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@vue/composition-api": "^1.0.0-rc.1",
|
||||||
|
"vue": "^3.0.0-0 || ^2.6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@vue/composition-api": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pkg-types": {
|
"node_modules/pkg-types": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmmirror.com/pkg-types/-/pkg-types-1.1.3.tgz",
|
"resolved": "https://registry.npmmirror.com/pkg-types/-/pkg-types-1.1.3.tgz",
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lsp-uuid": "^3.2.0",
|
"lsp-uuid": "^3.2.0",
|
||||||
|
"pinia": "^2.2.4",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"vue": "^3.2.25",
|
"vue": "^3.2.25",
|
||||||
"vue-draggable-plus": "^0.5.3"
|
"vue-draggable-plus": "^0.5.3"
|
||||||
|
|||||||
27
src/components/AdaptivePage.vue
Normal file
27
src/components/AdaptivePage.vue
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div style="width: 100%;">
|
||||||
|
<slot name="header"></slot>
|
||||||
|
</div>
|
||||||
|
<div style="width: 100%;min-height: 480px;background-color: #f7f8fa;">
|
||||||
|
<slot>
|
||||||
|
MAIN
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 100%;">
|
||||||
|
<slot name="footer"></slot>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
const dataSources = ref({})
|
||||||
|
|
||||||
|
onMounted(()=>
|
||||||
|
{
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@ -3,6 +3,8 @@
|
|||||||
<div>
|
<div>
|
||||||
compoent
|
compoent
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 组件区域 -->
|
||||||
<div style="overflow-y: auto; overflow-x: hidden; flex-grow: 0; flex-shrink: 0; flex-basis: 250px;">
|
<div style="overflow-y: auto; overflow-x: hidden; flex-grow: 0; flex-shrink: 0; flex-basis: 250px;">
|
||||||
<div ref="el2" style="display: flex; flex-direction: column; height: 500px; width: 100%;">
|
<div ref="el2" style="display: flex; flex-direction: column; height: 500px; width: 100%;">
|
||||||
<div v-for="item in componentsList" :key="item.id" style="height: 30px; width: 250px; border: 1px solid red;">
|
<div v-for="item in componentsList" :key="item.id" style="height: 30px; width: 250px; border: 1px solid red;">
|
||||||
@ -11,8 +13,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="flex-grow: 1; flex-shrink: 0; overflow-y: auto;">
|
<div style="flex-grow: 1; flex-shrink: 0; overflow-y: auto;">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 设计器 -->
|
||||||
<div
|
<div
|
||||||
style="display: flex; flex-direction: row; width: 100%; height: 500px; overflow-y: auto; border: 1px solid black;">
|
style="display: flex; flex-direction: row; width: 100%; height: 500px; overflow-y: auto; border: 1px solid black;">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
@ -20,6 +22,7 @@
|
|||||||
{{ list }}
|
{{ list }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 渲染区 -->
|
||||||
<div style="width: 100%; height: 500px; overflow-y: auto; border: 1px solid black;">
|
<div style="width: 100%; height: 500px; overflow-y: auto; border: 1px solid black;">
|
||||||
动态渲染
|
动态渲染
|
||||||
<!-- <component :is="componentMapping['Rate']" v-bind="{}"/> -->
|
<!-- <component :is="componentMapping['Rate']" v-bind="{}"/> -->
|
||||||
@ -27,6 +30,10 @@
|
|||||||
{{ component.id }}
|
{{ component.id }}
|
||||||
</DynamicComponent>
|
</DynamicComponent>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 测试区域 -->
|
||||||
|
<div>
|
||||||
|
<TestComponent></TestComponent>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -37,19 +44,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import TestComponent from './TestComponent.vue';
|
||||||
|
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import NestedFunction from './NestedFunction.vue';
|
import NestedFunction from './NestedFunction.vue';
|
||||||
import DynamicComponent from './DynamicComponent.vue';
|
import DynamicComponent from './DynamicComponent.vue';
|
||||||
|
|
||||||
import { useDraggable } from 'vue-draggable-plus';
|
import { useDraggable } from 'vue-draggable-plus';
|
||||||
import { uuid } from 'lsp-uuid';
|
import { uuid } from 'lsp-uuid';
|
||||||
import { IComponent } from '../type/IComponent.ts';
|
import { IPageComponent } from '../type/IPageComponent.ts';
|
||||||
import { componentScheme } from '../schemes/scheme.ts';
|
import { componentScheme } from '../schemes/scheme.ts';
|
||||||
|
|
||||||
const componentsList = ref<any[]>([]);
|
const componentsList = ref<any[]>([]);
|
||||||
|
|
||||||
|
|
||||||
const list = ref<IComponent[]>([]);
|
const list = ref<IPageComponent[]>([]);
|
||||||
const el2 = ref();
|
const el2 = ref();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11,15 +11,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDraggable} from 'vue-draggable-plus'
|
import { useDraggable} from 'vue-draggable-plus'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { IComponent } from '../type/IComponent'
|
import { IPageComponent } from '../type/IComponent'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
modelValue: IComponent[]
|
modelValue: IPageComponent[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'update:modelValue', value: IComponent[]): void
|
(e: 'update:modelValue', value: IPageComponent[]): void
|
||||||
}
|
}
|
||||||
const emits = defineEmits<Emits>()
|
const emits = defineEmits<Emits>()
|
||||||
const list = computed({
|
const list = computed({
|
||||||
|
|||||||
@ -1,29 +1,18 @@
|
|||||||
<!-- DynamicSlotsComponent.vue -->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- 动态插槽 -->
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<slot name="header"></slot>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<slot name="main"></slot>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<slot name="footer"></slot>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps } from 'vue';
|
import { useCounterStore } from '@/stores/useSchemeStore'
|
||||||
|
// 可以在组件中的任意位置访问 `store` 变量 ✨
|
||||||
// 接收一个动态插槽名作为 prop
|
const store = useCounterStore()
|
||||||
const props = defineProps({
|
function add() {
|
||||||
dynamicSlotName: String
|
store.increment()
|
||||||
});
|
}
|
||||||
|
function sub() {
|
||||||
|
store.decrement()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>{{ store.count }}</div>
|
||||||
|
<a-button @click=add>add</a-button>
|
||||||
|
<a-button @click=sub>sub</a-button>
|
||||||
|
|
||||||
|
</template>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
// componentMapping.ts
|
// componentMapping.ts
|
||||||
import TestComponent from './TestComponent.vue';
|
import TestComponent from './TestComponent.vue';
|
||||||
|
import AdaptivePage from './AdaptivePage.vue';
|
||||||
import Icon from './Icon.tsx';
|
import Icon from './Icon.tsx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -25,12 +26,12 @@ import {
|
|||||||
Countdown, Steps, Step, Switch,
|
Countdown, Steps, Step, Switch,
|
||||||
Tabs, TabPane, Tag, Textarea,
|
Tabs, TabPane, Tag, Textarea,
|
||||||
TimePicker, Timeline, TimelineItem, Tooltip,
|
TimePicker, Timeline, TimelineItem, Tooltip,
|
||||||
Transfer, Tree, TreeSelect, Trigger,Typography,TypographyParagraph, TypographyText, TypographyTitle,
|
Transfer, Tree, TreeSelect, Trigger, Typography, TypographyParagraph, TypographyText, TypographyTitle,
|
||||||
Upload, OverflowList, VerificationCode, Watermark
|
Upload, OverflowList, VerificationCode, Watermark
|
||||||
} from '@arco-design/web-vue';
|
} from '@arco-design/web-vue';
|
||||||
|
|
||||||
export const componentMapping: { [key: string]: any } = {
|
export const componentMapping: { [key: string]: any } = {
|
||||||
TestComponent,
|
TestComponent, AdaptivePage,
|
||||||
Affix, Alert, Anchor, AnchorLink,
|
Affix, Alert, Anchor, AnchorLink,
|
||||||
AutoComplete, Avatar, AvatarGroup, BackTop,
|
AutoComplete, Avatar, AvatarGroup, BackTop,
|
||||||
Badge, Breadcrumb, BreadcrumbItem, Button,
|
Badge, Breadcrumb, BreadcrumbItem, Button,
|
||||||
@ -53,7 +54,7 @@ export const componentMapping: { [key: string]: any } = {
|
|||||||
Countdown, Steps, Step, Switch,
|
Countdown, Steps, Step, Switch,
|
||||||
Tabs, TabPane, Tag, Textarea,
|
Tabs, TabPane, Tag, Textarea,
|
||||||
TimePicker, Timeline, TimelineItem, Tooltip,
|
TimePicker, Timeline, TimelineItem, Tooltip,
|
||||||
Transfer, Tree, TreeSelect, Trigger,Typography,TypographyParagraph, TypographyText, TypographyTitle,
|
Transfer, Tree, TreeSelect, Trigger, Typography, TypographyParagraph, TypographyText, TypographyTitle,
|
||||||
Upload, OverflowList, VerificationCode, Watermark
|
Upload, OverflowList, VerificationCode, Watermark
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,12 @@ import ArcoVue from '@arco-design/web-vue';
|
|||||||
// 额外引入图标库
|
// 额外引入图标库
|
||||||
import ArcoVueIcon from '@arco-design/web-vue/es/icon';
|
import ArcoVueIcon from '@arco-design/web-vue/es/icon';
|
||||||
import '@arco-design/web-vue/dist/arco.css';
|
import '@arco-design/web-vue/dist/arco.css';
|
||||||
|
import {createPinia} from "pinia"
|
||||||
|
|
||||||
|
const pinia = createPinia()
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
app.use(pinia)
|
||||||
app.use(ArcoVue);
|
app.use(ArcoVue);
|
||||||
app.use(ArcoVueIcon);
|
app.use(ArcoVueIcon);
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"type": "AdaptivePage",
|
"type": "AdaptivePage",
|
||||||
|
"name":"AdaptivePage",
|
||||||
|
"id":"AdaptivePage",
|
||||||
"version": "2.0",
|
"version": "2.0",
|
||||||
"props": {},
|
"props": {},
|
||||||
|
"class":"",
|
||||||
|
"style":"",
|
||||||
"variables": {},
|
"variables": {},
|
||||||
"dataSources":{},
|
"dataSources":{},
|
||||||
"functions" : {},
|
"functions" : {},
|
||||||
|
|||||||
@ -1,4 +1,23 @@
|
|||||||
{
|
{
|
||||||
|
"AdaptivePage": {
|
||||||
|
"type": "AdaptivePage",
|
||||||
|
"name": "AdaptivePage",
|
||||||
|
"id": "AdaptivePage",
|
||||||
|
"version": "2.0",
|
||||||
|
"props": {},
|
||||||
|
"class": "",
|
||||||
|
"style": "",
|
||||||
|
"variables": {},
|
||||||
|
"dataSources": {},
|
||||||
|
"functions": {},
|
||||||
|
"orchestrations": {},
|
||||||
|
"events": {},
|
||||||
|
"slots": {},
|
||||||
|
"header": {},
|
||||||
|
"footer": {},
|
||||||
|
"children": {},
|
||||||
|
"meta": {}
|
||||||
|
},
|
||||||
"Affix": {
|
"Affix": {
|
||||||
"type": "Affix",
|
"type": "Affix",
|
||||||
"name": "affix",
|
"name": "affix",
|
||||||
|
|||||||
@ -1,4 +1,23 @@
|
|||||||
export const componentScheme = {
|
export const componentScheme = {
|
||||||
|
"AdaptivePage": {
|
||||||
|
"type": "AdaptivePage",
|
||||||
|
"name": "AdaptivePage",
|
||||||
|
"id": "AdaptivePage",
|
||||||
|
"version": "2.0",
|
||||||
|
"props": {},
|
||||||
|
"class": "",
|
||||||
|
"style": "",
|
||||||
|
"variables": {},
|
||||||
|
"dataSources": {},
|
||||||
|
"functions": {},
|
||||||
|
"orchestrations": {},
|
||||||
|
"events": {},
|
||||||
|
"slots": {},
|
||||||
|
"header": {},
|
||||||
|
"footer": {},
|
||||||
|
"children": {},
|
||||||
|
"meta": {}
|
||||||
|
},
|
||||||
"Affix": {
|
"Affix": {
|
||||||
"type": "Affix",
|
"type": "Affix",
|
||||||
"name": "affix",
|
"name": "affix",
|
||||||
|
|||||||
17
src/stores/useSchemeStore.ts
Normal file
17
src/stores/useSchemeStore.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { IPageComponent } from '../type/IPageComponent';
|
||||||
|
import { ref,computed } from 'vue';
|
||||||
|
|
||||||
|
export const useCounterStore = defineStore('counter', () => {
|
||||||
|
const count = ref(0)
|
||||||
|
const schema=ref<IPageComponent>()
|
||||||
|
const doubleCount = computed(() => count.value * 2)
|
||||||
|
function increment() {
|
||||||
|
count.value++
|
||||||
|
}
|
||||||
|
function decrement() {
|
||||||
|
count.value--
|
||||||
|
}
|
||||||
|
|
||||||
|
return { count,schema, doubleCount, increment,decrement }
|
||||||
|
})
|
||||||
@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
@ -7,5 +7,8 @@ export interface IComponent {
|
|||||||
props: JSON;
|
props: JSON;
|
||||||
style: string;
|
style: string;
|
||||||
class: string;
|
class: string;
|
||||||
children: IComponent[];
|
events:JSON;
|
||||||
|
orchestrations:JSON;
|
||||||
|
version:string;
|
||||||
|
loop:JSON
|
||||||
}
|
}
|
||||||
12
src/type/IPageComponent.ts
Normal file
12
src/type/IPageComponent.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { IComponent } from "./IComponent";
|
||||||
|
|
||||||
|
export interface IPageComponent extends IComponent
|
||||||
|
{
|
||||||
|
variables:JSON;
|
||||||
|
dataSources:JSON;
|
||||||
|
functions:JSON;
|
||||||
|
header:JSON;
|
||||||
|
footer:JSON;
|
||||||
|
meta:JSON;
|
||||||
|
children: IPageComponent[];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user