Vue iView Table组件里,如何用render函数实现长尾词的动态展示?

2026-04-06 12:121阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计197个文字,预计阅读时间需要1分钟。

Vue iView Table组件里,如何用render函数实现长尾词的动态展示?

`a` 标签和 `img` 标签等的 `render` 函数需要使用 `attrs` 设置参数,而 `Button` 等组件需要使用 `props` 设置属性。例如:

Vue iView Table组件里,如何用render函数实现长尾词的动态展示?

javascripttable: { columns: [ { key: id, title: ID }, { key: demo_a, title: a 标签示例, render: (h, params)=> { return h(a, { attrs: a }); } } ]}

a标签img标签等的render函数需要使用attrs设置参数,Button等组件需要props设置属性

table: { columns: [ { key: "id", title: "ID" }, { key: "demo_a", title: "a标签示例", render: (h, params) => { return h("a", { attrs: { // 如果要在标签中加入属性,例如img中src属性,a标签中href属性,此时需要用到attrs来加入而不是props href: " www.liepin.com/" + params.row.demo_a, target: "_blank" } }, params.row.demo_a // 此处为a标签的展示文本 ); } }, { key: "demo_button", title: "button标签示例", render: (h, params) => { return h("div", [ h("Button", { props: { // 如果要在Button中加入属性,此时需要用到props来加入而不是attrs type: "primary", size: "small" }, style: { marginRight: "8px" }, on: { click: function() { mCheck.singleShow(params.row); } } }, "查看" // 此处为Button的展示文本 ), h("Button", { props: { type: "error", size: "small" }, on: { click: function() { mCheck.singleDel(params.row, params.index); } } }, "删除" // 此处为Button的展示文本 ) ]); } } ], data:[] }

本文共计197个文字,预计阅读时间需要1分钟。

Vue iView Table组件里,如何用render函数实现长尾词的动态展示?

`a` 标签和 `img` 标签等的 `render` 函数需要使用 `attrs` 设置参数,而 `Button` 等组件需要使用 `props` 设置属性。例如:

Vue iView Table组件里,如何用render函数实现长尾词的动态展示?

javascripttable: { columns: [ { key: id, title: ID }, { key: demo_a, title: a 标签示例, render: (h, params)=> { return h(a, { attrs: a }); } } ]}

a标签img标签等的render函数需要使用attrs设置参数,Button等组件需要props设置属性

table: { columns: [ { key: "id", title: "ID" }, { key: "demo_a", title: "a标签示例", render: (h, params) => { return h("a", { attrs: { // 如果要在标签中加入属性,例如img中src属性,a标签中href属性,此时需要用到attrs来加入而不是props href: " www.liepin.com/" + params.row.demo_a, target: "_blank" } }, params.row.demo_a // 此处为a标签的展示文本 ); } }, { key: "demo_button", title: "button标签示例", render: (h, params) => { return h("div", [ h("Button", { props: { // 如果要在Button中加入属性,此时需要用到props来加入而不是attrs type: "primary", size: "small" }, style: { marginRight: "8px" }, on: { click: function() { mCheck.singleShow(params.row); } } }, "查看" // 此处为Button的展示文本 ), h("Button", { props: { type: "error", size: "small" }, on: { click: function() { mCheck.singleDel(params.row, params.index); } } }, "删除" // 此处为Button的展示文本 ) ]); } } ], data:[] }