Comments (12)
没太看懂问题是什么,能详细描述下你的问题吗,是说page-fragment-select选完之后,页面内的page-fragment-container组件渲染内容没生效?
from tmagic-editor.
没太看懂问题是什么,能详细描述下你的问题吗,是说page-fragment-select选完之后,页面内的page-fragment-container组件渲染内容没生效?
是的
from tmagic-editor.
没太看懂问题是什么,能详细描述下你的问题吗,是说page-fragment-select选完之后,页面内的page-fragment-container组件渲染内容没生效?
我写了一个组件根据table选择的页面片去进行渲染,
如上面两图所示,我将第一项的页面片切换成了第二页,视图并未发生改变
下图是我使用展开配置中的选择框选择对应的页面片所展现出来的效果
from tmagic-editor.
正常的「展开配置」是什么?
from tmagic-editor.
这个表单是通过tmgaic form schema写的还是你自己单独封装了组件,如果是自己写的组件需要向外抛出change事件,参考https://github.com/Tencent/tmagic-editor/blob/30929e8bd313bfdb9e3492faf362dd60ce82435f/packages/editor/src/fields/PageFragmentSelect.vue#L57C3-L57C43
正常的「展开配置」是什么?
tmgaic form schema写的,
就是你们这个table的展开配置功能啊
table
展开配置后还有个下拉框,我去下拉那个下拉框数据是发生改变的,我去下拉默认的下拉框,数据不会发生改变
就是一个你们这个tmgaic form schema改变了数据,没有将更新传递到的runtime的问题
from tmagic-editor.
这个表单是通过tmgaic form schema写的还是你自己单独封装了组件,如果是自己写的组件需要向外抛出change事件,参考https://github.com/Tencent/tmagic-editor/blob/30929e8bd313bfdb9e3492faf362dd60ce82435f/packages/editor/src/fields/PageFragmentSelect.vue#L57C3-L57C43
正常的「展开配置」是什么?
请看VCR
CleanShot.2024-01-18.at.13.01.09.mp4
from tmagic-editor.
需要看你的swiper组件是怎么实现的,我这里简单的模拟了一个组件,是符合预期的
<template>
<div :id="`${config.id || ''}`" :style="style">
<PageFragmentContainer v-for="item in config.fragments" :key="item.id" :config="item"></PageFragmentContainer>
</div>
</template>
<script lang="ts" setup>
import { computed, inject } from 'vue';
import Core from '@tmagic/core';
import PageFragmentContainer from '@tmagic/ui/src/page-fragment-container/src/PageFragmentContainer.vue';
import useApp from '@tmagic/ui/src/useApp';
const props = withDefaults(
defineProps<{
config: any;
model?: any;
}>(),
{
model: () => ({}),
},
);
const app: Core | undefined = inject('app');
const style = computed(() => app?.transformStyle(props.config.style || {}));
useApp({
config: props.config,
});
</script>
export default [
{
name: 'fragments',
type: 'table',
items: [
{
type: 'page-fragment-select',
name: 'pageFragmentId',
label: '页面片',
},
],
},
];
from tmagic-editor.
export default [ { name: 'fragments', type: 'table', items: [ { type: 'page-fragment-select', name: 'pageFragmentId', label: '页面片', }, ], }, ];
export default [
{
name: 'current',
type: 'data-source-input',
text: '激活索引'
},
{
type: 'table',
name: 'fragments',
items: [
{
type: 'page-fragment-select',
name: 'id',
label: 'Swiper页面片'
}
]
}
]
测试了一下发现用id当作键时出现我所提及到的情况
from tmagic-editor.
是使用PageFragmentContainer组件来渲染的吗?PageFragmentContainer要求使用的pageFragmentId
from tmagic-editor.
是使用PageFragmentContainer组件来渲染的吗?PageFragmentContainer要求使用的pageFragmentId
export default [
{
type: 'table',
name: 'fragments',
items: [
{
type: 'page-fragment-select',
name: 'id',
label: 'Swiper页面片'
}
]
}
]
<template>
<div :id="`${config.id || ''}`" :style="style">
<PageFragmentContainer
v-for="(item, index) in config.fragments"
:key="index"
:config="{
pageFragmentId: item.id
}"
></PageFragmentContainer>
</div>
</template>
<script lang="ts" setup>
import { computed, inject } from 'vue'
import Core from '@tmagic/core'
// import PageFragmentContainer from '@tmagic/ui/src/page-fragment-container/src/PageFragmentContainer.vue'
// import useApp from '@tmagic/ui/src/useApp'
import useApp from '@ui/utils/useApp'
import PageFragmentContainer from '@ui/pageFragmentContainer'
const props = withDefaults(
defineProps<{
config: any
model?: any
}>(),
{
model: () => ({})
}
)
const app: Core | undefined = inject('app')
const style = computed(() => app?.transformStyle(props.config.style || {}))
useApp({
config: props.config
})
</script>
如果我将id改为id1或其他就正常了
export default [
{
type: 'table',
name: 'fragments',
items: [
{
type: 'page-fragment-select',
name: 'id1',
label: 'Swiper页面片'
}
]
}
]
<template>
<div :id="`${config.id || ''}`" :style="style">
<PageFragmentContainer
v-for="(item, index) in config.fragments"
:key="index"
:config="{
pageFragmentId: item.id1
}"
></PageFragmentContainer>
</div>
</template>
<script lang="ts" setup>
import { computed, inject } from 'vue'
import Core from '@tmagic/core'
// import PageFragmentContainer from '@tmagic/ui/src/page-fragment-container/src/PageFragmentContainer.vue'
// import useApp from '@tmagic/ui/src/useApp'
import useApp from '@ui/utils/useApp'
import PageFragmentContainer from '@ui/pageFragmentContainer'
const props = withDefaults(
defineProps<{
config: any
model?: any
}>(),
{
model: () => ({})
}
)
const app: Core | undefined = inject('app')
const style = computed(() => app?.transformStyle(props.config.style || {}))
useApp({
config: props.config
})
</script>
from tmagic-editor.
id默认会作为element-plus table row-key 传入,当其发生变化时会导致table重新渲染,猜测是这个原因。可以试试使用rowKey重新指定element-plus row-key的值
from tmagic-editor.
这是@tmagic/form table的问题
from tmagic-editor.
Related Issues (20)
- packages/editor/src/services/editor.ts 文件中的update方法有bug,导致父子组件更新时调用doUpdate子组件获取到info.parent是旧数据 HOT 1
- 画布尺寸切换组件 DeviceGroup 失效
- 蒙层切换层级位置后删除,再选中其他蒙层无法展示
- form-editor组件拖进去不显示
- asyncLoadJs在并发加载两个js文件时会导致相对路径错误 HOT 1
- build会导致内存溢出
- 按照文档快速开始报错global is not defined HOT 1
- tmagic-admin怎么和tmagic-editor结合呢
- radio-group的使用方式发生改变了吗? HOT 1
- componentGroupList自定义icon HOT 1
- 组件内部通过api获取到某些数据,如何用这些数据去反向修改右侧编辑框中的数据呢? HOT 3
- xp系统 是否可以通过增加plugin 来兼容 HOT 3
- input组件无法及时更新数据。 HOT 2
- 给组设置border 会导致组下的组件 位置偏移 HOT 2
- 运行pnpm bootstrap报错
- 初始化项目遇到的几个问题 HOT 1
- 请问有tmagic-editor的数据源的使用方法说明文档吗? HOT 1
- 集成到自己的项目中页面一直加载不出来 HOT 4
- chrome91版本,调用 editorService.update() 会出错,是否可以在下个版本兼容一下 HOT 4
- 数据源 处理 报错path_1[1] HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmagic-editor.