html引入element ui 失败

我就是参照elementui的例子想显示一个表格,结果列变成一行一个的了。对前端不太了解,各位大神可以指点一下吗?

<html>
  <head>
    <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>
  </head>
  <body>
    <div id="app" >

          <el-table
          :data="tableData">
    <el-table-column prop="date" label="Date" sortable/>
    <el-table-column prop="name" label="Name" />
    <el-table-column prop="address" label="Address"  />
  </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>
  </body>
</html>
阅读 2.5k
3 个回答
  • el-table-column 标签不是单标签
<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>

已参与了 SegmentFault 思否社区 10 周年「问答」打卡 ,欢迎正在阅读的你也加入。

<html>
    <head>
        <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>
    </head>
    <body>
        <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>
    </body>
</html>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏