排名
3
文章
317
粉丝
22
评论
14
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术

vue3表格加载一点静态数据
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="Date" prop="date" width="180" />
<el-table-column label="Name" prop="name" width="180" />
<el-table-column label="Address" prop="address" />
</el-table>
</template>
<script>
export default defineComponent({
name: 'dynamicTable',
setup() {
const state = reactive({
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',
},
]
})
onMounted(() => {
})
return {
...toRefs(state)
}
},
})
</script>
数据从后台读取的
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="Id" prop="id" width="180" />
<el-table-column label="宗地位置" prop="landName" width="180" />
<el-table-column label="地块位置" prop="areaposition" />
</el-table>
</template>
<script>
import { getList } from '@/api/landInfo'
export default defineComponent({
name: 'dynamicTable',
setup() {
const state = reactive({
tableData: []
})
const fetchData = async () => {
const result = await getList()
state.tableData = result.data
}
const queryData = () => {
fetchData()
}
onMounted(() => {
fetchData()
})
return {
...toRefs(state),
queryData,
}
},
})
</script>
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)
评价
默认昵称