chore: vtj 依赖更新,微应用集成 postmate

This commit is contained in:
wangxuefeng
2025-02-26 17:26:19 +08:00
parent 11018965bd
commit f7468bde86
22 changed files with 1581 additions and 1035 deletions

View File

@@ -1,12 +1,19 @@
<script setup lang="ts">
import { onMounted } from 'vue';
import Postmate from 'postmate';
import { createRenderer } from '@vtj/renderer'
import { type BlockSchema } from '@vtj/core'
const dsl: BlockSchema = {
"name": "Tes",
"name": "ProjectList",
"locked": false,
"inject": [],
"state": {},
"state": {
"editModalVisible": {
"type": "JSExpression",
"value": "false"
}
},
"lifeCycles": {},
"methods": {},
"computed": {},
@@ -17,90 +24,220 @@ const dsl: BlockSchema = {
"slots": [],
"dataSources": {},
"__VTJ_BLOCK__": true,
"__VERSION__": "1739787968332",
"id": "45t6ex2qh",
"__VERSION__": "1740469448492",
"id": "cmc7fwbj7e",
"nodes": [
{
"id": "esmzkcp2p",
"name": "ElButton",
"id": "lvv6dsl62",
"name": "ElTable",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": "按钮",
"children": [
{
"id": "pfh43lnvu",
"name": "ElTableColumn",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": "",
"props": {
"prop": "id",
"label": "项目 id",
"fixed": "left",
"index": 1
},
"directives": [],
"events": {}
},
{
"id": "sz31teqlm",
"name": "ElTableColumn",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": [],
"props": {
"prop": "name",
"label": "项目名称"
},
"directives": [],
"events": {}
},
{
"id": "wiozj7tbe",
"name": "ElTableColumn",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": [
{
"id": "2320850l3f",
"name": "ElButton",
"from": "element-plus",
"invisible": false,
"locked": false,
"slot": {
"name": "default",
"params": [
"row",
"column",
"$index"
]
},
"children": "编辑",
"props": {
"type": "primary",
"size": "small",
"plain": false,
"text": true,
"bg": false,
"loadingIcon": "Loading",
"icon": "Edit"
},
"directives": [],
"events": {
"click": {
"name": "click",
"handler": {
"type": "JSFunction",
"value": "() => {\r\n console.log('window', window)\r\n console.log('this.context.row', this.context.row)\r\n // this.state.editModalVisible = true\r\n const routers = this.$router.getRoutes()\r\n console.log('routers', routers)\r\n console.log('this.$router', this.$router)\r\n}"
},
"modifiers": {}
}
}
}
],
"props": {
"prop": "address",
"label": "操作",
"fixed": "right"
},
"directives": [],
"events": {}
}
],
"props": {
"type": "primary"
"data": [
{
"id": "1",
"name": "miniapp",
"actions": {
"edit": true
}
},
{
"id": "2",
"name": "mobile",
"actions": {
"edit": true
}
},
{
"id": "3",
"name": "web",
"actions": {
"edit": true
}
}
],
"size": "small",
"highlightCurrentRow": true,
"show-summary": false,
"lazy": true,
"scrollbar-always-on": true,
"flexible": true,
"stripe": true,
"showHeader": true
},
"directives": [],
"events": {}
},
{
"id": "8l081hgwdy",
"name": "AModal",
"from": "ant-design-vue",
"invisible": false,
"locked": false,
"children": [
{
"id": "8ojtz79z3q",
"name": "p",
"from": "",
"invisible": false,
"locked": false,
"children": "Some contents...",
"props": {},
"directives": [],
"events": {}
},
{
"id": "8s3fwx31ti",
"name": "p",
"from": "",
"invisible": false,
"locked": false,
"children": "Some contents...",
"props": {},
"directives": [],
"events": {}
},
{
"id": "8vn1umw4ja",
"name": "p",
"from": "",
"invisible": false,
"locked": false,
"children": "Some contents...",
"props": {},
"directives": [],
"events": {}
}
],
"props": {
"open": true,
"title": "Basic Modal"
},
"directives": [
{
"id": "9v357t0ryi",
"name": "vIf",
"value": {
"type": "JSExpression",
"value": "this.state.editModalVisible"
}
}
],
"events": {
"click": {
"name": "click",
"cancel": {
"name": "cancel",
"handler": {
"type": "JSFunction",
"value": "() => {\r\n console.log('1231111')\r\n}"
"value": "() => {\r\n this.state.editModalVisible = false\r\n}"
},
"modifiers": {}
},
"ok": {
"name": "ok",
"handler": {
"type": "JSFunction",
"value": "() => {\r\n this.state.editModalVisible = false\r\n}"
},
"modifiers": {}
}
}
},
{
"id": "26lluhulco",
"name": "ElImage",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": [],
"props": {
"style": {
"width": "100px",
"height": "100px"
},
"src": "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg",
"previewSrcList": [
"https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg",
"https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg",
"https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg",
"https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg",
"https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg",
"https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg",
"https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg"
]
},
"directives": [],
"events": {}
},
{
"id": "45t6mmt7r",
"name": "ElDialog",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": "对话框弹窗内容",
"props": {
"title": "标题",
"modelValue": true
},
"directives": [],
"events": {}
},
{
"id": "7pf44qdhl",
"name": "ElContainer",
"from": "element-plus",
"invisible": false,
"locked": false,
"children": [],
"props": {
"style": {
"width": "100%",
"height": "100%"
}
},
"directives": [],
"events": {}
}
]
};
onMounted(() => {
const handshake = new Postmate.Model({});
handshake.then(parent => {
parent.emit('sync-context', 'Hello, World!');
});
});
const { renderer } = createRenderer({
dsl,
});