我尝试在 NestJS/GraphQL 应用程序上使用 Jest 并使用 Prisma 作为我的 ORM 进行端到端测试。
这里发生的情况是 Prisma 与 Postgres 打开了太多连接,我尝试在每次测试后使用 prisma.$disconnect() 来解决这个问题,但它似乎不起作用......
这是我到目前为止所尝试过的。
import { PrismaService } from '../src/prisma.service';
describe('Users', () => {
let app: INestApplication;
const gql = '/graphql';
let prisma;
beforeEach(async () => {
prisma = new PrismaService();
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
afterEach(async () => {
await prisma.$disconnect();
});
it('Query - Users', async () => {
//Using prisma to query database
});
}); …
Run Code Online (Sandbox Code Playgroud) 我目前正在尝试使用 bootstrap-vue 表(https://bootstrap-vue.js.org/docs/components/table)动态显示/隐藏。
到目前为止,我只设法隐藏了标题,但单元格不会消失,这是一个问题,因为单元格不在好的标题前面(数字应该在天以下,而“成分”应该在项目下。
这是“有效”的内容:
fields: [
{key: "day", label: "Day",sortable: true, thStyle:"display:none"},
{key: "item", label: "Item",sortable: true}
]
Run Code Online (Sandbox Code Playgroud)
我想知道是否有可能在 vueJS 之外执行此操作,并直接使用 CSS 更改列的属性。
谢谢您的帮助 !
路易斯
我想为 bootstrap-vue 表实现一个双页脚。
<b-table
striped hover
:items="items"
:fields="visibleFields"
:sort-compare="sortCompare"
:sort-by.sync="sortBy"
foot-clone
selectable
select-mode="single"
@row-selected="onRowSelected"
:tbody-tr-class="rowClass"
>
<!-- Footers total nutritional values -->
<template v-slot:foot(serving)="data">
<span>Total:</span>
</template>
</b-table>
Run Code Online (Sandbox Code Playgroud)
该表如下所示:
Bootstrap vue文档仅提供此内容来创建页脚:
<!-- Footers total nutritional values -->
<template v-slot:foot(serving)="data">
<span>Total:</span>
</template>
Run Code Online (Sandbox Code Playgroud)
问题是我不知道如何添加第二个页脚。另一种方法是在表格下方添加一个 div 并显示我想要的内容,但我认为有一种更简洁的方法可以做到这一点。