小编Cat*_*nin的帖子

证实外部分页不显示页码

我有一个v-data-table,正在尝试向其中添加分页。我在这里跟随了示例文档看不到我在做什么错。创建我的组件后,它将调用我的后端以填充项目列表。然后将其传递到数据表。

我也有一个搜索栏,如果我输入任何内容,那么页面编号就会弹出。

的HTML

<v-data-table
      :headers="headers"
      :items="incidents"
      :search="search"
      :pagination.sync="pagination"
      hide-actions
      class="elevation-1"
      item-key="incident_number"
    >

</v-data-table>

 /* table row html in between */

<div class="text-xs-center pt-2">
      <v-pagination v-model="pagination.page" :length="pages" </v-pagination>
</div>
Run Code Online (Sandbox Code Playgroud)

JS

我有一个计算出的属性,可以像示例中那样计算出页码。

computed: {
      pages ()
      {
        if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null)
        {
          return 0
        }

        return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)

      },
    }
Run Code Online (Sandbox Code Playgroud)

frontend vue.js vue-component vuejs2 vuetify.js

5
推荐指数
1
解决办法
2803
查看次数

Vuetify网格布局-如何填充网格中元素的高度

我正在尝试创建网格布局,但是遇到了麻烦。

我要创建的布局如下图所示。显示起来比解释容易。

  • 侧面板卡布局,其中将填充项目列表。一种
  • 2元素顶面板。
  • 一个大的主面板可以填充下面的剩余空间。

当前布局

我尝试使用vuetify网格布局系统来获取它,但无法很好地填充所有空间。我的代码如下。

有没有一种创建此网格布局的好方法?

<v-container fluid grid-list-md box>
  <v-layout row>

    <v-flex d-flex xs3>
      <v-layout row wrap>
        <v-card color="orange lighten-2" tile flat>
          <v-card-text>{{ lorem.slice(0, 90) }}</v-card-text>
        </v-card>

        <v-divider></v-divider>

        <v-card color="orange lighten-2" tile flat>
          <v-card-text>{{ lorem.slice(0, 90) }}</v-card-text>
        </v-card>

        <v-divider></v-divider>

        <v-card color="orange lighten-2" tile flat>
          <v-card-text>{{ lorem.slice(0, 90) }}</v-card-text>
        </v-card>

        <v-divider></v-divider>

        <v-card color="orange lighten-2" tile flat>
          <v-card-text>{{ lorem.slice(0, 90) }}</v-card-text>
        </v-card>
      </v-layout>

    </v-flex>

    <v-flex d-flex xs9>

      <v-layout row wrap>
        <v-layout row>
          <v-flex d-flex>
            <v-card color="blue-grey" dark tile flat>
              <v-card-text>{{ …
Run Code Online (Sandbox Code Playgroud)

grid-layout flexbox vue.js vuetify.js

5
推荐指数
1
解决办法
1万
查看次数

测试时访问 Flask 配置时出错

在为我的 Flask 应用程序编写测试时,我在尝试设置 Flask 配置设置时遇到了一个问题。

通常,我这样做:

import unittest

from factory import create_app


class ConfigTests(unittest.TestCase):

    def setUp(self):
        app = create_app('flask_test.cfg')
        app.testing = True
        self.app = app.test_client()

    def test_app_is_development(self):
        self.assertTrue(self.app.config['SECRET_KEY'] is 'secret_key')
        self.assertTrue(self.app.config['DEBUG'] is True)
Run Code Online (Sandbox Code Playgroud)

这导致了错误

AttributeError: 'FlaskClient' 对象没有属性 'config'

仅从调试中我看到没有“配置”属性,而是我不得不self.app.application.config让它工作。

import unittest

from factory import create_app


class ConfigTests(unittest.TestCase):

    def setUp(self):
        app = create_app('flask_test.cfg')
        app.testing = True
        self.app = app.test_client()

    def test_app_is_development(self):
        self.assertTrue(self.app.application.config['SECRET_KEY'] is 'secret_key')
        self.assertTrue(self.app.application.config['DEBUG'] is True)
Run Code Online (Sandbox Code Playgroud)

我在做什么,Flask 是否在更新中改变了这一点,或者有更好的方法来做到这一点?

编辑:在顶部块中错误地发布了代码,现在是正确的

python testing config flask

4
推荐指数
1
解决办法
1439
查看次数

Adding SSL certs to NGINX docker container

I'm trying to add SSL certs (generated with LetsEncrypt) to my nginx. The nginx is built from a docker-compose file where I create a volume from my host to the container so the containers can access the certs and private key.

volumes:
  - /etc/nginx/certs/:/etc/nginx/certs/
Run Code Online (Sandbox Code Playgroud)

When the nginx container starts and fails with the following error

[emerg] 1#1: BIO_new_file("/etc/nginx/certs/fullchain.pem") failed 
(SSL: error:02001002:system library:fopen:No such file or 
directory:fopen('/etc/nginx/certs/fullchain.pem','r') 
error:2006D080:BIO routines:BIO_new_file:no such file)
Run Code Online (Sandbox Code Playgroud)

My nginx config file looks like this:

server {
    listen …
Run Code Online (Sandbox Code Playgroud)

ssl nginx ssl-certificate docker docker-compose

3
推荐指数
1
解决办法
7635
查看次数