Showing posts with label VUEIVIEW. Show all posts
Showing posts with label VUEIVIEW. Show all posts

Tuesday, 18 May 2021

Monday, 17 May 2021

Vue iview plugin Table rendering function

 https://www.programmersought.com/article/2791772083/

https://www.iviewui.com/components/table-en



, a simple example

  1. render: (h, params) => {
  2. return h('span', 'hello');
  3. }

3, display multiple content at the same time

  1. render: (h, params) => {
  2. return h('div', [
  3. h('span', params.row.name),
  4. h('span', ' ('+params.row.age+')')
  5. ]);
  6. }

4, processing the data

Any data processing can be done before the data is returned

1>Time format conversion
  1. render: (h, params) => {
  2. let time = this.$moment(params.row.time).format('YYYY-MM-DD HH:mm:ss')
  3. return h('span', time);
  4. }
2> data processing: array splicing string, etc.
  1. render: (h, params) => {
  2. let str = ''
  3. for (let i = 0, len = params.row.arr.length; i < len; i++) {
  4. str += `${params.row.arr[i].name}-${params.row.arr[i].age} | `
  5. }
  6. return h('span', str);