GithubHelp home page GithubHelp logo

Comments (12)

khuntoriia avatar khuntoriia commented on June 1, 2024

没太看懂问题是什么,能详细描述下你的问题吗,是说page-fragment-select选完之后,页面内的page-fragment-container组件渲染内容没生效?

from tmagic-editor.

sunlho avatar sunlho commented on June 1, 2024

没太看懂问题是什么,能详细描述下你的问题吗,是说page-fragment-select选完之后,页面内的page-fragment-container组件渲染内容没生效?

是的

from tmagic-editor.

sunlho avatar sunlho commented on June 1, 2024

没太看懂问题是什么,能详细描述下你的问题吗,是说page-fragment-select选完之后,页面内的page-fragment-container组件渲染内容没生效?

我写了一个组件根据table选择的页面片去进行渲染,
CleanShot 2024-01-18 at 08 54 01@2x
CleanShot 2024-01-18 at 08 54 16@2x

如上面两图所示,我将第一项的页面片切换成了第二页,视图并未发生改变

下图是我使用展开配置中的选择框选择对应的页面片所展现出来的效果


CleanShot 2024-01-18 at 08 55 08@2x

from tmagic-editor.

khuntoriia avatar khuntoriia commented on June 1, 2024
image 这个表单是通过tmgaic form schema写的还是你自己单独封装了组件,如果是自己写的组件需要向外抛出change事件,参考https://github.com/Tencent/tmagic-editor/blob/30929e8bd313bfdb9e3492faf362dd60ce82435f/packages/editor/src/fields/PageFragmentSelect.vue#L57C3-L57C43

正常的「展开配置」是什么?

from tmagic-editor.

sunlho avatar sunlho commented on June 1, 2024

image 这个表单是通过tmgaic form schema写的还是你自己单独封装了组件,如果是自己写的组件需要向外抛出change事件,参考https://github.com/Tencent/tmagic-editor/blob/30929e8bd313bfdb9e3492faf362dd60ce82435f/packages/editor/src/fields/PageFragmentSelect.vue#L57C3-L57C43
正常的「展开配置」是什么?

CleanShot 2024-01-18 at 12 52 04@2x
tmgaic form schema写的,
就是你们这个table的展开配置功能啊
table
CleanShot 2024-01-18 at 12 54 31@2x
展开配置后还有个下拉框,我去下拉那个下拉框数据是发生改变的,我去下拉默认的下拉框,数据不会发生改变

就是一个你们这个tmgaic form schema改变了数据,没有将更新传递到的runtime的问题

from tmagic-editor.

sunlho avatar sunlho commented on June 1, 2024

image 这个表单是通过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.

jia000 avatar jia000 commented on June 1, 2024

需要看你的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.

sunlho avatar sunlho commented on June 1, 2024
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.

jia000 avatar jia000 commented on June 1, 2024

是使用PageFragmentContainer组件来渲染的吗?PageFragmentContainer要求使用的pageFragmentId

from tmagic-editor.

sunlho avatar sunlho commented on June 1, 2024

是使用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.

jia000 avatar jia000 commented on June 1, 2024

id默认会作为element-plus table row-key 传入,当其发生变化时会导致table重新渲染,猜测是这个原因。可以试试使用rowKey重新指定element-plus row-key的值

from tmagic-editor.

sunlho avatar sunlho commented on June 1, 2024

这是@tmagic/form table的问题

from tmagic-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.