Element UI 中表格列变形为一行一个,如何解决?
html 引入 element ui 失败的解决办法
在将 Element UI 引入 HTML 项目时,可能会遇到列变形为一行一个的现象。这个问题通常是由标签未写全导致的。
以给出的代码示例为例,
<el-table-column prop="name" label="Name"><el-table-column></el-table-column></el-table-column>
完整的代码如下:
<meta charset="UTF-8"><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><meta name="viewport" content="width=device-width,initial-scale=1.0"><script src="https://unpkg.com/vue@next"></script><!-- import CSS --><link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css"><!-- import JavaScript --><script src="https://unpkg.com/element-plus"></script><div id="app"> <el-table :data="tableData"><el-table-column prop="date" label="Date" sortable></el-table-column><el-table-column prop="name" label="Name"></el-table-column><el-table-column prop="address" label="Address"></el-table-column></el-table> </div> <script> const App = { data() { return { message: "Hello Element Plus", tableData: [ { date: '2016-05-03', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { date: '2016-05-02', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { date: '2016-05-04', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { date: '2016-05-01', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, ], }; }, }; const app = Vue.createApp(App); app.use(ElementPlus); app.mount("#app"); </script>
通过修改
以上就是Element UI 中表格列变形为一行一个,如何解决?的详细内容,更多请关注其它相关文章!