chore: 渲染适配器版本更新
This commit is contained in:
parent
6b2c7bad00
commit
813547331d
@ -1,5 +1,12 @@
|
||||
# @sy/y-code-platform
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @sy/wujie-vue3-renderer-adapter@1.0.2
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sy/y-code-platform",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"private": true,
|
||||
"author": {
|
||||
"name": "wangxuefeng",
|
||||
|
@ -1,5 +1,11 @@
|
||||
# @sy/wujie-vue2-renderer-adapter
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 渲染适配器增加 props 深度监听处理
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sy/wujie-vue2-renderer-adapter",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "wujie-vue2 ycode renderer adapter",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
@ -9,11 +9,53 @@ import { version } from '/package.json';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'WujieAdapter',
|
||||
data() {
|
||||
return {
|
||||
// 使用 data 创建可变的 subAppProps
|
||||
subAppPropsData: this.getInitialSubAppProps(),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
finalUrl() {
|
||||
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 {
|
||||
...this.$props,
|
||||
adapterInfo: {
|
||||
@ -21,15 +63,26 @@ export default defineComponent({
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
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);
|
||||
},
|
||||
methods: {
|
||||
// 更新 subAppProps
|
||||
updateSubAppProps(props) {
|
||||
this.subAppPropsData = {
|
||||
...props,
|
||||
adapterInfo: {
|
||||
version,
|
||||
},
|
||||
_timestamp: Date.now(), // 添加时间戳确保每次更新都是新对象
|
||||
};
|
||||
|
||||
// 如果子应用已加载,可以通过 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) {
|
||||
console.log(`${this.name || this.fileId} 加载完成`, appWindow);
|
||||
},
|
||||
@ -56,6 +109,13 @@ export default defineComponent({
|
||||
bus.$on('render-success', this.handleRenderSuccess);
|
||||
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: {
|
||||
applicationId: {
|
||||
required: true,
|
||||
@ -90,6 +150,10 @@ export default defineComponent({
|
||||
router: {
|
||||
type: Object,
|
||||
},
|
||||
searchParams: {
|
||||
default: () => ({}),
|
||||
type: Object,
|
||||
},
|
||||
sync: {
|
||||
default: true,
|
||||
type: Boolean,
|
||||
@ -110,7 +174,7 @@ export default defineComponent({
|
||||
width="100%"
|
||||
height="100%"
|
||||
:degrade="degrade"
|
||||
:props="subAppProps"
|
||||
:props="subAppPropsData"
|
||||
:before-load="beforeLoad"
|
||||
:after-mount="afterMount"
|
||||
:interceptors="interceptors"
|
||||
|
@ -1,5 +1,11 @@
|
||||
# @sy/wujie-vue3-renderer-adapter
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 渲染适配器增加 props 深度监听处理
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sy/wujie-vue3-renderer-adapter",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "wujie-vue3 ycode renderer adapter",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
@ -75,7 +75,6 @@ const subAppProps = ref({
|
||||
watch(
|
||||
() => ({ ...props }),
|
||||
(newProps) => {
|
||||
console.log('props 发生变化', newProps);
|
||||
subAppProps.value = {
|
||||
...newProps,
|
||||
adapterInfo: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user