【发布时间】:2021-07-02 19:00:22
【问题描述】:
我从服务器获取 google protobuf 格式的数据。
但无法理解如何填充 Primevue 数据表列。
这是我的示例代码:
<template>
<Card>
<template #content>
<DataTable
:value="statisticList"
:paginator="true"
:rows="10"
:rowsPerPageOptions="[10, 20, 50]"
class="p-datatable-sm"
paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown"
responsiveLayout="scroll"
stripedRows
showGridlines
>
<Column field="getId()" header="Id" :sortable="true"></Column>
<Column field="getSymbol()" header="Symbol"></Column>
<template #paginatorLeft>
<Button
type="button"
icon="pi pi-refresh"
class="p-button-text"
@click="getStatistics"
/>
</template>
</DataTable>
</template>
</Card>
</template>
<script>
import { statisticSubject } from "../../services/SubjectService";
import { requestStatistic } from "../../services/WebsocketService";
export default {
data() {
return {
statisticList: null,
};
},
created() {
requestStatistic();
statisticSubject.subscribe((e) => (this.statisticList = e));
},
methods: {
getStatistics() {
requestStatistic();
},
},
};
</script>
这是我的 protobuf 结构的一部分:
syntax = "proto3";
message StatisticBuffer {
int64 id = 1;
string symbol = 2;
string exchange = 3;
}
注意:
数据获取和加载没有任何问题购买primevue不会填满列。
如何解决这个问题?
【问题讨论】:
标签: javascript vue.js vuejs3 primevue