Giter VIP home page Giter VIP logo

Comments (6)

xiaocheng555 avatar xiaocheng555 commented on July 3, 2024

20231221-181245.mp4
不知道是不是嵌套生成的原因 这样没问题 image 这样就有问题 image 有没有正确的使用示例

组件是怎么样的

from el-table-virtual-scroll.

Yyc1537 avatar Yyc1537 commented on July 3, 2024

image
代码太多,大概就是这样,嵌套使用组件,多表头又再生成一次

from el-table-virtual-scroll.

xiaocheng555 avatar xiaocheng555 commented on July 3, 2024

方便写个demo吗

from el-table-virtual-scroll.

xiaocheng555 avatar xiaocheng555 commented on July 3, 2024

image 代码太多,大概就是这样,嵌套使用组件,多表头又再生成一次

没有复现出来
image

// complex1.vue
<template>
  <div>
    <virtual-scroll
      ref="virtualScroll"
      :data="list"
      :item-size="62"
      key-prop="id"
      @change="(virtualList) => tableData = virtualList">
      <el-table
        :data="tableData"
        height="800"
        row-key="id"
        style="width: 100%">
        <virtual-column fixed width="60" type="selection"></virtual-column>
        <virtual-column fixed label="索引" width="80" type="index"></virtual-column>
        <virtual-column type="expand" >
          <template slot-scope="scope">
            {{ scope.row.text }}
          </template>
        </virtual-column>
        <el-table-column
          prop="date"
          label="日期"
          width="150">
        </el-table-column>
        <template v-for="(column, index) in columns">
          <ComplexColum
            :column="column"
            :key="index">
          </ComplexColum>
        </template>
      </el-table>
    </virtual-scroll>
  </div>
</template>

<script>
import VirtualScroll, { VirtualColumn } from 'el-table-virtual-scroll'
import { mockData } from '@/utils'
import ComplexColum from './complexColum1'

export default {
  components: {
    VirtualScroll,
    VirtualColumn,
    ComplexColum
  },
  data () {
    return {
      list: mockData(0, 2000),
      tableData: [],
      columns: [
        {
          title: '内容',
          prop: 'text',
          width: 400
        },
        {
          title: '合并列',
          columns: [
            {
              width: 200,
              title: '地址',
              prop: 'address'
            },
            {
              width: 200,
              title: '名称',
              prop: 'name'
            },
            {
              width: 100,
              title: 'id',
              prop: 'id'
            }
          ]
        },
        {
          title: '内容2',
          prop: 'text2',
          width: 400,
        },
        {
          title: '名称',
          prop: 'name'
        }
      ]
    }
  },
  methods: {

  },
  created () {
  }
}
</script>

<style lang='less' scoped>

</style>
// complexColum1.vue
<template>
  <el-table-column :width="column.width">
    <template slot="header">
      {{ column.title }}
    </template>
    <template slot-scope="{row}">
      {{ row[column.prop] }}
    </template>
    <template v-for="(child, index) in column.columns">
      <component
        :is="'Child'"
        :key="index"
        :column="child">
      </component>
    </template>
  </el-table-column>
</template>

<script>
export default {
  name: 'complex-colunm',
  props: {
    column: {
      type: Object
    }
  },
  beforeCreate () {
    this.$options.components.Child = require('./complexColum1').default
  }
}
</script>

<style lang='less' scoped>
</style>

from el-table-virtual-scroll.

Yyc1537 avatar Yyc1537 commented on July 3, 2024

好的,我再研究研究

from el-table-virtual-scroll.

xiaocheng555 avatar xiaocheng555 commented on July 3, 2024

好的,我再研究研究

ok,有问题再@我

from el-table-virtual-scroll.

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.