在Nuxt(递归组件)中注册插件时出错?

时间:2019-02-04 17:42:03

标签: vue.js nuxt.js

我正在努力将此https://github.com/euvl/vue-js-grid添加到我的nuxt插件中!

sed -E 's/([[:space:]]*)"properties": {/\1"additionalProperties": false,|\1"properties": {/g'| tr '|' '\n' 中,我有:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "required": [
    "accounts"
  ],
  "accounts": {
    "required": "account",
    "additionalProperties": false,
    "properties": {
      "account": {
        "type": "array",
        "minItems": 1,
        "maxItems": 999,
        "required": [
          "scheme",
          "accountType",
          "accountSubType"
        ],
        "items": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "scheme": {
              "description": "scheme",
              "type": "object",
              "required": [
                "schemeName",
                "identification"
              ],
              "additionalProperties": false,
              "properties": {
                "schemeName": {
                  "type": "string",
                  "maxLength": 40
                },
                "identification": {
                  "type": "string",
                  "maxLength": 256
                },
                "name": {
                  "type": "string",
                  "maxLength": 70
                },
                "secondaryIdentification": {
                  "type": "string",
                  "maxLength": 35
                }
              }
            },
            "currency": {
              "type": "string",
              "format": "iso-4217",
              "pattern": "^[A-Z]{3,3}$",
              "maxLength": 3,
              "example": "EUR"
            },
            "accountType": {
              "type": "string"
            },
            "accountSubType": {
              "type": "string",
              "maxLength": 35
            }
          }
        }
      }
    }
  }
}

nuxt.config.js中,我有:

plugins: [
  { src: '~/plugins/vue-js-grid.js', ssr: false }
],

vue-js-grid.js中,我有:

import Vue from 'vue'
import Grid from 'vue-js-grid'

Vue.use(Grid)

(它们的示例代码) 但我收到此错误:

mytemplate.vue

据我所知,我是否已正确注册所有内容?不是吗?

1 个答案:

答案 0 :(得分:1)

您是否尝试在模板中以小写形式写grid

<template>
  <div>
    <no-ssr>
      <grid
        :draggable="true"
        :sortable="true"
        :items="items"
        :height="100"
        :width="150">
        <template slot="cell" slot-scope="props">
          <div>{{props.item}}</div>
        </template>
      </grid>
    </no-ssr>
  </div>
</template>

另外,在注册插件之后,您是否重新启动了开发服务器?