ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 1.引入组件 ```javascript import vTable from "@/components/table.vue" ``` ## 2. 注册组件 ```javascript components: { vTable }, ``` ## 3.在模板内使用 ```html <v-table :columns="columns" :list="data"></v-table> ``` ## 4. 初始化数据 ``` javascript data(){ return { data: [{ name: 'John Brown', age: 18, address: 'New York No. 1 Lake Park', id: "1", }, { name: 'Jim Green', age: 25, address: 'London No. 1 Lake Park', id: "2" } ], columns: [{ title: "ID", key: "id" }, { title: 'Name', key: 'name' }, { title: 'Age', key: 'age' }, { title: 'Address', key: 'address' } ], } } ``` ## 完成