chore: 渲染适配器版本更新
This commit is contained in:
parent
6b2c7bad00
commit
813547331d
@ -1,5 +1,12 @@
|
|||||||
# @sy/y-code-platform
|
# @sy/y-code-platform
|
||||||
|
|
||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies
|
||||||
|
- @sy/wujie-vue3-renderer-adapter@1.0.2
|
||||||
|
|
||||||
## 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sy/y-code-platform",
|
"name": "@sy/y-code-platform",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"author": {
|
"author": {
|
||||||
"name": "wangxuefeng",
|
"name": "wangxuefeng",
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# @sy/wujie-vue2-renderer-adapter
|
# @sy/wujie-vue2-renderer-adapter
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 渲染适配器增加 props 深度监听处理
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sy/wujie-vue2-renderer-adapter",
|
"name": "@sy/wujie-vue2-renderer-adapter",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "wujie-vue2 ycode renderer adapter",
|
"description": "wujie-vue2 ycode renderer adapter",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -9,11 +9,53 @@ import { version } from '/package.json';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'WujieAdapter',
|
name: 'WujieAdapter',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 使用 data 创建可变的 subAppProps
|
||||||
|
subAppPropsData: this.getInitialSubAppProps(),
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
finalUrl() {
|
finalUrl() {
|
||||||
return `${this.url}?fileId=${this.fileId}&projectId=${this.projectId}&applicationId=${this.applicationId}`;
|
return `${this.url}?fileId=${this.fileId}&projectId=${this.projectId}&applicationId=${this.applicationId}`;
|
||||||
},
|
},
|
||||||
subAppProps() {
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听所有 props 变化
|
||||||
|
$props: {
|
||||||
|
handler(newProps) {
|
||||||
|
console.log('props 发生变化,更新 subAppProps');
|
||||||
|
this.updateSubAppProps(newProps);
|
||||||
|
},
|
||||||
|
deep: true, // 深度监听,捕获嵌套属性变化
|
||||||
|
immediate: true, // 立即执行一次
|
||||||
|
},
|
||||||
|
// 单独监听常用的几个关键 prop,以确保它们的变化被捕获
|
||||||
|
fileId() {
|
||||||
|
this.updateSubAppProps(this.$props);
|
||||||
|
},
|
||||||
|
projectId() {
|
||||||
|
this.updateSubAppProps(this.$props);
|
||||||
|
},
|
||||||
|
applicationId() {
|
||||||
|
this.updateSubAppProps(this.$props);
|
||||||
|
},
|
||||||
|
payload: {
|
||||||
|
handler() {
|
||||||
|
this.updateSubAppProps(this.$props);
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
searchParams: {
|
||||||
|
handler() {
|
||||||
|
this.updateSubAppProps(this.$props);
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取初始 subAppProps
|
||||||
|
getInitialSubAppProps() {
|
||||||
return {
|
return {
|
||||||
...this.$props,
|
...this.$props,
|
||||||
adapterInfo: {
|
adapterInfo: {
|
||||||
@ -21,15 +63,26 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
// 更新 subAppProps
|
||||||
beforeUnmount() {
|
updateSubAppProps(props) {
|
||||||
const { bus } = WujieVue;
|
this.subAppPropsData = {
|
||||||
bus.$off('message', this.handleMessage);
|
...props,
|
||||||
bus.$off('ready', this.handleReady);
|
adapterInfo: {
|
||||||
bus.$off('render-success', this.handleRenderSuccess);
|
version,
|
||||||
bus.$off('render-fail', this.handleRenderFail);
|
},
|
||||||
},
|
_timestamp: Date.now(), // 添加时间戳确保每次更新都是新对象
|
||||||
methods: {
|
};
|
||||||
|
|
||||||
|
// 如果子应用已加载,可以通过 bus 通知它 props 已更新
|
||||||
|
if (this.name || this.fileId) {
|
||||||
|
try {
|
||||||
|
const { bus } = WujieVue;
|
||||||
|
bus.$emit('props-updated', this.subAppPropsData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('发送 props 更新事件失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
afterMount(appWindow: any) {
|
afterMount(appWindow: any) {
|
||||||
console.log(`${this.name || this.fileId} 加载完成`, appWindow);
|
console.log(`${this.name || this.fileId} 加载完成`, appWindow);
|
||||||
},
|
},
|
||||||
@ -56,6 +109,13 @@ export default defineComponent({
|
|||||||
bus.$on('render-success', this.handleRenderSuccess);
|
bus.$on('render-success', this.handleRenderSuccess);
|
||||||
bus.$on('render-fail', this.handleRenderFail);
|
bus.$on('render-fail', this.handleRenderFail);
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
const { bus } = WujieVue;
|
||||||
|
bus.$off('message', this.handleMessage);
|
||||||
|
bus.$off('ready', this.handleReady);
|
||||||
|
bus.$off('render-success', this.handleRenderSuccess);
|
||||||
|
bus.$off('render-fail', this.handleRenderFail);
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
applicationId: {
|
applicationId: {
|
||||||
required: true,
|
required: true,
|
||||||
@ -90,6 +150,10 @@ export default defineComponent({
|
|||||||
router: {
|
router: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
searchParams: {
|
||||||
|
default: () => ({}),
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
sync: {
|
sync: {
|
||||||
default: true,
|
default: true,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -110,7 +174,7 @@ export default defineComponent({
|
|||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
:degrade="degrade"
|
:degrade="degrade"
|
||||||
:props="subAppProps"
|
:props="subAppPropsData"
|
||||||
:before-load="beforeLoad"
|
:before-load="beforeLoad"
|
||||||
:after-mount="afterMount"
|
:after-mount="afterMount"
|
||||||
:interceptors="interceptors"
|
:interceptors="interceptors"
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# @sy/wujie-vue3-renderer-adapter
|
# @sy/wujie-vue3-renderer-adapter
|
||||||
|
|
||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 渲染适配器增加 props 深度监听处理
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sy/wujie-vue3-renderer-adapter",
|
"name": "@sy/wujie-vue3-renderer-adapter",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "wujie-vue3 ycode renderer adapter",
|
"description": "wujie-vue3 ycode renderer adapter",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -75,7 +75,6 @@ const subAppProps = ref({
|
|||||||
watch(
|
watch(
|
||||||
() => ({ ...props }),
|
() => ({ ...props }),
|
||||||
(newProps) => {
|
(newProps) => {
|
||||||
console.log('props 发生变化', newProps);
|
|
||||||
subAppProps.value = {
|
subAppProps.value = {
|
||||||
...newProps,
|
...newProps,
|
||||||
adapterInfo: {
|
adapterInfo: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user