预期:我将从返回的 API 中获取日期时间字符串。该值"2019-08-15T15:58:14.597Z"应在表格中显示为`DD-MM-YYYY HH:MM。Vuetify 自带数据表组件,可以对数据进行升序和降序排序。我还想将此功能用于日期,使其升序和降序排序。
简短的问题:API 中的日期应保存并以表格中的另一种“样式”显示,但排序功能使用实际日期对象。
我目前的代码:
<template>
<v-content class="mt-12 ml-12">
<h1 class="font-weight-black display-3">Servers</h1>
<v-data-table
class="elevation-1"
:headers="headers"
:items="columns"
:items-per-page="15"
>
</v-data-table>
<ul id="example-1">
<li v-for="(data, index) in columns.data" :key="index">
{{ data.attributes }}
</li>
</ul>
</v-content>
</template>
<script>
import instances from '../services/instances';
export default {
data() {
return {
columns: [],
headers: [
{ text: 'Server Name', value: 'attributes.name' },
{ text: 'Spieler', value: 'attributes.playerCount' },
{ text: 'Avg. FPS', value: 'attributes.details.rust_fps_avg' },
{ text: 'Wiped', value: 'attributes.details.rust_last_wipe' …Run Code Online (Sandbox Code Playgroud) 我有以下查询作为SQL的作业:-
编写一个查询,告知每个作者写了多少本书。在每行上首先提供作者ID,然后提供书籍数量。对列表进行排序,以使书籍写作最多的作者在顶部,而底部则是书籍最少的作者。作者的数量相同,其作者ID的作者顺序进一步由高至低。
我已经通过替换groupby,orderby和count()函数尝试了不同的选项。
SELECT authorid as "authorid",
COUNT (bookid) as "count"
FROM book
GROUP by authorid
HAVING COUNT (bookid) >=1
ORDER BY COUNT (bookid) DESC;
Run Code Online (Sandbox Code Playgroud)
您的结果
authorid count
204 4
202 3
206 1
201 1
207 1
205 1
Run Code Online (Sandbox Code Playgroud)
预期结果
authorid count
204 4
202 3
201 1
205 1
206 1
207 1
Run Code Online (Sandbox Code Playgroud)