{"id":60950,"date":"2026-01-16T17:33:24","date_gmt":"2026-01-16T09:33:24","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/60950.html"},"modified":"2026-01-16T17:33:24","modified_gmt":"2026-01-16T09:33:24","slug":"element-plus-table%e7%bb%84%e4%bb%b6-%e5%b0%81%e8%a3%85%e5%88%97%e9%9a%90%e8%97%8f%e5%8a%9f%e8%83%bd%ef%bc%8c%e5%b9%b6%e9%9d%9e-v-if-%e6%88%96-v-for%ef%bc%8c%e9%80%9a%e8%bf%87tableref-%e4%b8%8e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/60950.html","title":{"rendered":"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236"},"content":{"rendered":"<h4>\u5c01\u88c5 Element Plus Table \u5217\u9690\u85cf\u529f\u80fd<\/h4>\n<h5>\u4f7f\u7528 tableRef \u548c\u6837\u5f0f\u63a7\u5236\u5b9e\u73b0\u5217\u9690\u85cf<\/h5>\n<p>\u901a\u8fc7\u64cd\u4f5c\u8868\u683c\u7684 DOM \u7ed3\u6784\u548c\u6837\u5f0f&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u5217\u7684\u52a8\u6001\u9690\u85cf\u4e0e\u663e\u793a\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4f9d\u8d56 v-if \u6216 v-for&#xff0c;\u800c\u662f\u76f4\u63a5\u63a7\u5236\u5217\u7684\u53ef\u89c1\u6027\u3002<\/p>\n<p>&lt;template&gt;<br \/>\n  &lt;el-table ref&#061;&#034;tableRef&#034; :data&#061;&#034;tableData&#034;&gt;<br \/>\n    &lt;el-table-column prop&#061;&#034;date&#034; label&#061;&#034;\u65e5\u671f&#034; \/&gt;<br \/>\n    &lt;el-table-column prop&#061;&#034;name&#034; label&#061;&#034;\u59d3\u540d&#034; \/&gt;<br \/>\n    &lt;el-table-column prop&#061;&#034;address&#034; label&#061;&#034;\u5730\u5740&#034; \/&gt;<br \/>\n  &lt;\/el-table&gt;<br \/>\n  &lt;el-button &#064;click&#061;&#034;toggleColumn(&#039;name&#039;)&#034;&gt;\u5207\u6362\u59d3\u540d\u5217&lt;\/el-button&gt;<br \/>\n&lt;\/template&gt;<\/p>\n<p>&lt;script setup&gt;<br \/>\nimport { ref } from &#039;vue&#039;;<\/p>\n<p>const tableRef &#061; ref();<br \/>\nconst tableData &#061; [<br \/>\n  { date: &#039;2023-01-01&#039;, name: &#039;\u5f20\u4e09&#039;, address: &#039;\u5317\u4eac&#039; },<br \/>\n  { date: &#039;2023-01-02&#039;, name: &#039;\u674e\u56db&#039;, address: &#039;\u4e0a\u6d77&#039; }<br \/>\n];<\/p>\n<p>const toggleColumn &#061; (prop) &#061;&gt; {<br \/>\n  if (!tableRef.value) return;<\/p>\n<p>  const table &#061; tableRef.value.$el;<br \/>\n  const header &#061; table.querySelector(&#039;.el-table__header-wrapper&#039;);<br \/>\n  const body &#061; table.querySelector(&#039;.el-table__body-wrapper&#039;);<\/p>\n<p>  \/\/ \u83b7\u53d6\u6240\u6709\u5217<br \/>\n  const headerCols &#061; header.querySelectorAll(&#039;th&#039;);<br \/>\n  const bodyCols &#061; body.querySelectorAll(&#039;tr td&#039;);<\/p>\n<p>  \/\/ \u67e5\u627e\u76ee\u6807\u5217\u7d22\u5f15<br \/>\n  let colIndex &#061; -1;<br \/>\n  headerCols.forEach((th, index) &#061;&gt; {<br \/>\n    if (th.getAttribute(&#039;data-property&#039;) &#061;&#061;&#061; prop) {<br \/>\n      colIndex &#061; index;<br \/>\n    }<br \/>\n  });<\/p>\n<p>  if (colIndex &#061;&#061;&#061; -1) return;<\/p>\n<p>  \/\/ \u5207\u6362\u5217\u7684\u663e\u793a\u72b6\u6001<br \/>\n  headerCols[colIndex].style.display &#061;<br \/>\n    headerCols[colIndex].style.display &#061;&#061;&#061; &#039;none&#039; ? &#039;&#039; : &#039;none&#039;;<\/p>\n<p>  bodyCols.forEach((td, index) &#061;&gt; {<br \/>\n    if (index % headerCols.length &#061;&#061;&#061; colIndex) {<br \/>\n      td.style.display &#061;<br \/>\n        td.style.display &#061;&#061;&#061; &#039;none&#039; ? &#039;&#039; : &#039;none&#039;;<br \/>\n    }<br \/>\n  });<br \/>\n};<br \/>\n&lt;\/script&gt;<\/p>\n<h5>\u5c01\u88c5\u4e3a\u53ef\u590d\u7528\u7684 Hook<\/h5>\n<p>\u53ef\u4ee5\u5c06\u5217\u9690\u85cf\u903b\u8f91\u5c01\u88c5\u4e3a\u53ef\u590d\u7528\u7684 Composition API Hook&#xff1a;<\/p>\n<p>\/\/ useTableColumnToggle.js<br \/>\nimport { ref } from &#039;vue&#039;;<\/p>\n<p>export function useTableColumnToggle(tableRef) {<br \/>\n  const toggleColumn &#061; (prop) &#061;&gt; {<br \/>\n    if (!tableRef.value) return;<\/p>\n<p>    const table &#061; tableRef.value.$el;<br \/>\n    const header &#061; table.querySelector(&#039;.el-table__header-wrapper&#039;);<br \/>\n    const body &#061; table.querySelector(&#039;.el-table__body-wrapper&#039;);<\/p>\n<p>    const headerCols &#061; header.querySelectorAll(&#039;th&#039;);<br \/>\n    const bodyCols &#061; body.querySelectorAll(&#039;tr td&#039;);<\/p>\n<p>    let colIndex &#061; -1;<br \/>\n    headerCols.forEach((th, index) &#061;&gt; {<br \/>\n      if (th.getAttribute(&#039;data-property&#039;) &#061;&#061;&#061; prop) {<br \/>\n        colIndex &#061; index;<br \/>\n      }<br \/>\n    });<\/p>\n<p>    if (colIndex &#061;&#061;&#061; -1) return;<\/p>\n<p>    const isHidden &#061; headerCols[colIndex].style.display &#061;&#061;&#061; &#039;none&#039;;<br \/>\n    const newDisplay &#061; isHidden ? &#039;&#039; : &#039;none&#039;;<\/p>\n<p>    headerCols[colIndex].style.display &#061; newDisplay;<br \/>\n    bodyCols.forEach((td, index) &#061;&gt; {<br \/>\n      if (index % headerCols.length &#061;&#061;&#061; colIndex) {<br \/>\n        td.style.display &#061; newDisplay;<br \/>\n      }<br \/>\n    });<br \/>\n  };<\/p>\n<p>  return { toggleColumn };<br \/>\n}<\/p>\n<h5>\u4f7f\u7528 Hook \u7684\u793a\u4f8b<\/h5>\n<p>&lt;template&gt;<br \/>\n  &lt;el-table ref&#061;&#034;tableRef&#034; :data&#061;&#034;tableData&#034;&gt;<br \/>\n    &lt;el-table-column prop&#061;&#034;date&#034; label&#061;&#034;\u65e5\u671f&#034; \/&gt;<br \/>\n    &lt;el-table-column prop&#061;&#034;name&#034; label&#061;&#034;\u59d3\u540d&#034; \/&gt;<br \/>\n    &lt;el-table-column prop&#061;&#034;address&#034; label&#061;&#034;\u5730\u5740&#034; \/&gt;<br \/>\n  &lt;\/el-table&gt;<br \/>\n  &lt;el-button &#064;click&#061;&#034;toggleNameColumn&#034;&gt;\u5207\u6362\u59d3\u540d\u5217&lt;\/el-button&gt;<br \/>\n&lt;\/template&gt;<\/p>\n<p>&lt;script setup&gt;<br \/>\nimport { ref } from &#039;vue&#039;;<br \/>\nimport { useTableColumnToggle } from &#039;.\/useTableColumnToggle&#039;;<\/p>\n<p>const tableRef &#061; ref();<br \/>\nconst tableData &#061; [<br \/>\n  { date: &#039;2023-01-01&#039;, name: &#039;\u5f20\u4e09&#039;, address: &#039;\u5317\u4eac&#039; },<br \/>\n  { date: &#039;2023-01-02&#039;, name: &#039;\u674e\u56db&#039;, address: &#039;\u4e0a\u6d77&#039; }<br \/>\n];<\/p>\n<p>const { toggleColumn } &#061; useTableColumnToggle(tableRef);<br \/>\nconst toggleNameColumn &#061; () &#061;&gt; toggleColumn(&#039;name&#039;);<br \/>\n&lt;\/script&gt;<\/p>\n<h5>\u6ce8\u610f\u4e8b\u9879<\/h5>\n<li>\u8fd9\u79cd\u65b9\u6cd5\u76f4\u63a5\u64cd\u4f5c DOM&#xff0c;\u53ef\u80fd\u5728\u67d0\u4e9b\u6781\u7aef\u60c5\u51b5\u4e0b\u4e0d\u5982 Vue \u7684\u54cd\u5e94\u5f0f\u7cfb\u7edf\u7a33\u5b9a<\/li>\n<li>\u9700\u8981\u786e\u4fdd\u5217\u7684 prop \u5c5e\u6027\u4e0e\u6570\u636e\u4e2d\u7684\u5b57\u6bb5\u540d\u4e00\u81f4<\/li>\n<li>\u5bf9\u4e8e\u590d\u6742\u7684\u8868\u683c\u7ed3\u6784&#xff08;\u5982\u56fa\u5b9a\u5217\u3001\u591a\u7ea7\u8868\u5934&#xff09;&#xff0c;\u53ef\u80fd\u9700\u8981\u8c03\u6574\u9009\u62e9\u5668\u903b\u8f91<\/li>\n<li>\u6027\u80fd\u4e0a\u4f18\u4e8e v-if&#xff0c;\u56e0\u4e3a\u4e0d\u4f1a\u89e6\u53d1\u7ec4\u4ef6\u7684\u9500\u6bc1\u548c\u91cd\u5efa<\/li>\n<h5>\u6269\u5c55\u529f\u80fd<\/h5>\n<p>\u53ef\u4ee5\u8fdb\u4e00\u6b65\u6269\u5c55 Hook \u4ee5\u652f\u6301\u6279\u91cf\u64cd\u4f5c&#xff1a;<\/p>\n<p>\/\/ \u5728 useTableColumnToggle.js \u4e2d\u6dfb\u52a0<br \/>\nconst toggleColumns &#061; (props) &#061;&gt; {<br \/>\n  props.forEach(prop &#061;&gt; toggleColumn(prop));<br \/>\n};<\/p>\n<p>const hideColumns &#061; (props) &#061;&gt; {<br \/>\n  props.forEach(prop &#061;&gt; {<br \/>\n    if (!tableRef.value) return;<br \/>\n    \/\/ \u7c7b\u4f3c toggleColumn \u903b\u8f91&#xff0c;\u4f46\u5f3a\u5236\u9690\u85cf<br \/>\n  });<br \/>\n};<\/p>\n<p>const showColumns &#061; (props) &#061;&gt; {<br \/>\n  props.forEach(prop &#061;&gt; {<br \/>\n    if (!tableRef.value) return;<br \/>\n    \/\/ \u7c7b\u4f3c toggleColumn \u903b\u8f91&#xff0c;\u4f46\u5f3a\u5236\u663e\u793a<br \/>\n  });<br \/>\n};<\/p>\n<p>return { toggleColumn, toggleColumns, hideColumns, showColumns };<\/p>\n<p>avg.163.com\/topic\/detail\/8834434<br \/>\navg.163.com\/topic\/detail\/8834458<br \/>\navg.163.com\/topic\/detail\/8834461<br \/>\navg.163.com\/topic\/detail\/8834325<br \/>\navg.163.com\/topic\/detail\/8834014<br \/>\navg.163.com\/topic\/detail\/8834362<br \/>\navg.163.com\/topic\/detail\/8834356<br \/>\navg.163.com\/topic\/detail\/8834456<br \/>\navg.163.com\/topic\/detail\/8834455<br \/>\navg.163.com\/topic\/detail\/8834381<br \/>\navg.163.com\/topic\/detail\/8834353<br \/>\navg.163.com\/topic\/detail\/8834550<br \/>\navg.163.com\/topic\/detail\/8834516<br \/>\navg.163.com\/topic\/detail\/8834320<br \/>\navg.163.com\/topic\/detail\/8834581<br \/>\navg.163.com\/topic\/detail\/8834382<br \/>\navg.163.com\/topic\/detail\/8834493<br \/>\navg.163.com\/topic\/detail\/8834551<br \/>\navg.163.com\/topic\/detail\/8834481<br \/>\navg.163.com\/topic\/detail\/8834518<br \/>\navg.163.com\/topic\/detail\/8834515<br \/>\navg.163.com\/topic\/detail\/8834498<br \/>\navg.163.com\/topic\/detail\/8834041<br \/>\navg.163.com\/topic\/detail\/8834525<br \/>\navg.163.com\/topic\/detail\/8834494<br \/>\navg.163.com\/topic\/detail\/8834386<br \/>\navg.163.com\/topic\/detail\/8834490<br \/>\navg.163.com\/topic\/detail\/8834420<br \/>\navg.163.com\/topic\/detail\/8834519<br \/>\navg.163.com\/topic\/detail\/8834389<br \/>\navg.163.com\/topic\/detail\/8834542<br \/>\navg.163.com\/topic\/detail\/8834354<br \/>\navg.163.com\/topic\/detail\/8834421<br \/>\navg.163.com\/topic\/detail\/8834609<br \/>\navg.163.com\/topic\/detail\/8834380<br \/>\navg.163.com\/topic\/detail\/8834520<br \/>\navg.163.com\/topic\/detail\/8834578<br \/>\navg.163.com\/topic\/detail\/8834546<br \/>\navg.163.com\/topic\/detail\/8834611<br \/>\navg.163.com\/topic\/detail\/8834543<br \/>\navg.163.com\/topic\/detail\/8834083<br \/>\navg.163.com\/topic\/detail\/8834572<br \/>\navg.163.com\/topic\/detail\/8834553<br \/>\navg.163.com\/topic\/detail\/8834521<br \/>\navg.163.com\/topic\/detail\/8834426<br \/>\navg.163.com\/topic\/detail\/8834580<br \/>\navg.163.com\/topic\/detail\/8834480<br \/>\navg.163.com\/topic\/detail\/8834548<br \/>\navg.163.com\/topic\/detail\/8834422<br \/>\navg.163.com\/topic\/detail\/8834510<br \/>\navg.163.com\/topic\/detail\/8834448<br \/>\navg.163.com\/topic\/detail\/8834571<br \/>\navg.163.com\/topic\/detail\/8834641<br \/>\navg.163.com\/topic\/detail\/8834419<br \/>\navg.163.com\/topic\/detail\/8834668<br \/>\navg.163.com\/topic\/detail\/8834544<br \/>\navg.163.com\/topic\/detail\/8834605<br \/>\navg.163.com\/topic\/detail\/8834642<br \/>\navg.163.com\/topic\/detail\/8834636<br \/>\navg.163.com\/topic\/detail\/8834115<br \/>\navg.163.com\/topic\/detail\/8834606<br \/>\navg.163.com\/topic\/detail\/8834549<br \/>\navg.163.com\/topic\/detail\/8834637<br \/>\navg.163.com\/topic\/detail\/8834452<br \/>\navg.163.com\/topic\/detail\/8834612<br \/>\navg.163.com\/topic\/detail\/8834573<br \/>\navg.163.com\/topic\/detail\/8834643<br \/>\navg.163.com\/topic\/detail\/8834450<br \/>\navg.163.com\/topic\/detail\/8834483<br \/>\navg.163.com\/topic\/detail\/8834539<br \/>\navg.163.com\/topic\/detail\/8834603<br \/>\navg.163.com\/topic\/detail\/8834485<br \/>\navg.163.com\/topic\/detail\/8834696<br \/>\navg.163.com\/topic\/detail\/8834447<br \/>\navg.163.com\/topic\/detail\/8834576<br \/>\navg.163.com\/topic\/detail\/8834666<br \/>\navg.163.com\/topic\/detail\/8834608<br \/>\navg.163.com\/topic\/detail\/8834665<br \/>\navg.163.com\/topic\/detail\/8834142<br \/>\navg.163.com\/topic\/detail\/8834694<br \/>\navg.163.com\/topic\/detail\/8832562<br \/>\navg.163.com\/topic\/detail\/8834579<br \/>\navg.163.com\/topic\/detail\/8834664<br \/>\navg.163.com\/topic\/detail\/8834488<br \/>\navg.163.com\/topic\/detail\/8834604<br \/>\navg.163.com\/topic\/detail\/8834517<br \/>\navg.163.com\/topic\/detail\/8834511<br \/>\navg.163.com\/topic\/detail\/8834670<br \/>\navg.163.com\/topic\/detail\/8834631<br \/>\navg.163.com\/topic\/detail\/8834567<br \/>\navg.163.com\/topic\/detail\/8834513<br \/>\navg.163.com\/topic\/detail\/8834732<br \/>\navg.163.com\/topic\/detail\/8834478<br \/>\navg.163.com\/topic\/detail\/8834538<br \/>\navg.163.com\/topic\/detail\/8834695<br \/>\navg.163.com\/topic\/detail\/8834735<br \/>\navg.163.com\/topic\/detail\/8834633<br \/>\navg.163.com\/topic\/detail\/8834168<br \/>\navg.163.com\/topic\/detail\/8833802<br \/>\navg.163.com\/topic\/detail\/8834730<br \/>\navg.163.com\/topic\/detail\/8834203<br \/>\navg.163.com\/topic\/detail\/8834607<br \/>\navg.163.com\/topic\/detail\/8834690<br \/>\navg.163.com\/topic\/detail\/8834635<br \/>\navg.163.com\/topic\/detail\/8834731<br \/>\navg.163.com\/topic\/detail\/8834545<br \/>\navg.163.com\/topic\/detail\/8834540<br \/>\navg.163.com\/topic\/detail\/8834697<br \/>\navg.163.com\/topic\/detail\/8834656<br \/>\navg.163.com\/topic\/detail\/8834753<br \/>\navg.163.com\/topic\/detail\/8834599<br \/>\navg.163.com\/topic\/detail\/8834509<br \/>\navg.163.com\/topic\/detail\/8834569<br \/>\navg.163.com\/topic\/detail\/8834566<br \/>\navg.163.com\/topic\/detail\/8834755<br \/>\navg.163.com\/topic\/detail\/8834657<br \/>\navg.163.com\/topic\/detail\/8833918<br \/>\navg.163.com\/topic\/detail\/8834759<br \/>\navg.163.com\/topic\/detail\/8834235<br \/>\navg.163.com\/topic\/detail\/8834634<br \/>\navg.163.com\/topic\/detail\/8834786<br \/>\navg.163.com\/topic\/detail\/8834659<br \/>\navg.163.com\/topic\/detail\/8834752<br \/>\navg.163.com\/topic\/detail\/8834574<br \/>\navg.163.com\/topic\/detail\/8834568<br \/>\navg.163.com\/topic\/detail\/8834610<br \/>\navg.163.com\/topic\/detail\/8834733<br \/>\navg.163.com\/topic\/detail\/8834788<br \/>\navg.163.com\/topic\/detail\/8834685<br \/>\navg.163.com\/topic\/detail\/8834758<br \/>\navg.163.com\/topic\/detail\/8834626<br \/>\navg.163.com\/topic\/detail\/8834600<br \/>\navg.163.com\/topic\/detail\/8834598<br \/>\navg.163.com\/topic\/detail\/8834628<br \/>\navg.163.com\/topic\/detail\/8834688<br \/>\navg.163.com\/topic\/detail\/8834789<br \/>\navg.163.com\/topic\/detail\/8833946<br \/>\navg.163.com\/topic\/detail\/8833975<br \/>\navg.163.com\/topic\/detail\/8834662<br \/>\navg.163.com\/topic\/detail\/8834261<br \/>\navg.163.com\/topic\/detail\/8834693<br \/>\navg.163.com\/topic\/detail\/8834783<br \/>\navg.163.com\/topic\/detail\/8834727<br \/>\navg.163.com\/topic\/detail\/8834601<br \/>\navg.163.com\/topic\/detail\/8834687<br \/>\navg.163.com\/topic\/detail\/8834790<br \/>\navg.163.com\/topic\/detail\/8834723<br \/>\navg.163.com\/topic\/detail\/8834627<br \/>\navg.163.com\/topic\/detail\/8834638<br \/>\navg.163.com\/topic\/detail\/8834654<br \/>\navg.163.com\/topic\/detail\/8834722<br \/>\navg.163.com\/topic\/detail\/8834760<br \/>\navg.163.com\/topic\/detail\/8834013<br \/>\navg.163.com\/topic\/detail\/8834684<br \/>\navg.163.com\/topic\/detail\/8834655<br \/>\navg.163.com\/topic\/detail\/8834080<br \/>\navg.163.com\/topic\/detail\/8834787<br \/>\navg.163.com\/topic\/detail\/8834629<br \/>\navg.163.com\/topic\/detail\/8834661<br \/>\navg.163.com\/topic\/detail\/8834718<br \/>\navg.163.com\/topic\/detail\/8834728<br \/>\navg.163.com\/topic\/detail\/8834297<br \/>\navg.163.com\/topic\/detail\/8834747<br \/>\navg.163.com\/topic\/detail\/8834658<br \/>\navg.163.com\/topic\/detail\/8834686<br \/>\navg.163.com\/topic\/detail\/8834785<br \/>\navg.163.com\/topic\/detail\/8834757<br \/>\navg.163.com\/topic\/detail\/8834683<br \/>\navg.163.com\/topic\/detail\/8834327<br \/>\navg.163.com\/topic\/detail\/8834113<br \/>\navg.163.com\/topic\/detail\/8834781<br \/>\navg.163.com\/topic\/detail\/8834744<br \/>\navg.163.com\/topic\/detail\/8834751<br \/>\navg.163.com\/topic\/detail\/8834726<br \/>\navg.163.com\/topic\/detail\/8834169<br \/>\navg.163.com\/topic\/detail\/8834660<br \/>\navg.163.com\/topic\/detail\/8834360<br \/>\navg.163.com\/topic\/detail\/8834778<br \/>\navg.163.com\/topic\/detail\/8834201<br \/>\navg.163.com\/topic\/detail\/8834689<br \/>\navg.163.com\/topic\/detail\/8834750<br \/>\navg.163.com\/topic\/detail\/8834777<br \/>\navg.163.com\/topic\/detail\/8834384<br \/>\navg.163.com\/topic\/detail\/8834724<br \/>\navg.163.com\/topic\/detail\/8834734<br \/>\navg.163.com\/topic\/detail\/8834423<br \/>\navg.163.com\/topic\/detail\/8834720<br \/>\navg.163.com\/topic\/detail\/8834749<br \/>\navg.163.com\/topic\/detail\/8834754<br \/>\navg.163.com\/topic\/detail\/8834449<br \/>\navg.163.com\/topic\/detail\/8834746<br \/>\navg.163.com\/topic\/detail\/8834233<br \/>\navg.163.com\/topic\/detail\/8834784<br \/>\navg.163.com\/topic\/detail\/8834776<br \/>\navg.163.com\/topic\/detail\/8834779<br \/>\navg.163.com\/topic\/detail\/8834260<br \/>\navg.163.com\/topic\/detail\/8834775<br \/>\navg.163.com\/topic\/detail\/8834804<br \/>\navg.163.com\/topic\/detail\/8834479<br \/>\navg.163.com\/topic\/detail\/8834296<br \/>\navg.163.com\/topic\/detail\/8834514<br \/>\navg.163.com\/topic\/detail\/8834319<br \/>\navg.163.com\/topic\/detail\/8834541<br \/>\navg.163.com\/topic\/detail\/8834352<br \/>\navg.163.com\/topic\/detail\/8834570<br \/>\navg.163.com\/topic\/detail\/8834418<br \/>\navg.163.com\/topic\/detail\/8834630<br \/>\navg.163.com\/topic\/detail\/8834446<br \/>\navg.163.com\/topic\/detail\/8834663<br \/>\navg.163.com\/topic\/detail\/8834477<br \/>\navg.163.com\/topic\/detail\/8834691<br \/>\navg.163.com\/topic\/detail\/8834536<br \/>\navg.163.com\/topic\/detail\/8834729<br \/>\navg.163.com\/topic\/detail\/8834565<br \/>\navg.163.com\/topic\/detail\/8834748<br \/>\navg.163.com\/topic\/detail\/8834596<br \/>\navg.163.com\/topic\/detail\/8834782<br \/>\navg.163.com\/topic\/detail\/8834625<br \/>\navg.163.com\/topic\/detail\/8834652<br \/>\navg.163.com\/topic\/detail\/8834681<br \/>\navg.163.com\/topic\/detail\/8834714<br \/>\navg.163.com\/topic\/detail\/8834743<br \/>\navg.163.com\/topic\/detail\/8834774<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c01\u88c5 Element Plus Table \u5217\u9690\u85cf\u529f\u80fd\u4f7f\u7528 tableRef \u548c\u6837\u5f0f\u63a7\u5236\u5b9e\u73b0\u5217\u9690\u85cf\u901a\u8fc7\u64cd\u4f5c\u8868\u683c\u7684 DOM \u7ed3\u6784\u548c\u6837\u5f0f&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u5217\u7684\u52a8\u6001\u9690\u85cf\u4e0e\u663e\u793a\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4f9d\u8d56 v-if \u6216 v-for&#xff0c;\u800c\u662f\u76f4\u63a5\u63a7\u5236\u5217\u7684\u53ef\u89c1\u6027\u3002&lt;el-table-column prop<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3381,187,625],"topic":[],"class_list":["post-60950","post","type-post","status-publish","format-standard","hentry","category-server","tag-elementui","tag-javascript","tag-vue-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/60950.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5c01\u88c5 Element Plus Table \u5217\u9690\u85cf\u529f\u80fd\u4f7f\u7528 tableRef \u548c\u6837\u5f0f\u63a7\u5236\u5b9e\u73b0\u5217\u9690\u85cf\u901a\u8fc7\u64cd\u4f5c\u8868\u683c\u7684 DOM \u7ed3\u6784\u548c\u6837\u5f0f&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u5217\u7684\u52a8\u6001\u9690\u85cf\u4e0e\u663e\u793a\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4f9d\u8d56 v-if \u6216 v-for&#xff0c;\u800c\u662f\u76f4\u63a5\u63a7\u5236\u5217\u7684\u53ef\u89c1\u6027\u3002&lt;el-table-column prop\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/60950.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-16T09:33:24+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/60950.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/60950.html\",\"name\":\"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-16T09:33:24+00:00\",\"dateModified\":\"2026-01-16T09:33:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/60950.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/60950.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/60950.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/60950.html","og_locale":"zh_CN","og_type":"article","og_title":"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5c01\u88c5 Element Plus Table \u5217\u9690\u85cf\u529f\u80fd\u4f7f\u7528 tableRef \u548c\u6837\u5f0f\u63a7\u5236\u5b9e\u73b0\u5217\u9690\u85cf\u901a\u8fc7\u64cd\u4f5c\u8868\u683c\u7684 DOM \u7ed3\u6784\u548c\u6837\u5f0f&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u5217\u7684\u52a8\u6001\u9690\u85cf\u4e0e\u663e\u793a\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4f9d\u8d56 v-if \u6216 v-for&#xff0c;\u800c\u662f\u76f4\u63a5\u63a7\u5236\u5217\u7684\u53ef\u89c1\u6027\u3002&lt;el-table-column prop","og_url":"https:\/\/www.wsisp.com\/helps\/60950.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-16T09:33:24+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/60950.html","url":"https:\/\/www.wsisp.com\/helps\/60950.html","name":"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-16T09:33:24+00:00","dateModified":"2026-01-16T09:33:24+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/60950.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/60950.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/60950.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"element-plus table\u7ec4\u4ef6 \u5c01\u88c5\u5217\u9690\u85cf\u529f\u80fd\uff0c\u5e76\u975e v-if \u6216 v-for\uff0c\u901a\u8fc7tableRef \u4e0e\u6837\u5f0f\u63a7\u5236"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/60950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=60950"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/60950\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=60950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=60950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=60950"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=60950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}