vue.js - 在 Nuxt 中注册插件时出错,递归组件?
问题描述
我正在努力将这个https://github.com/euvl/vue-js-grid添加到我的 nuxt 插件中!
在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
我有:
<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>
(他们的示例代码)但我收到此错误:
commons.app.js:11507 [Vue warn]: Unknown custom element: <Grid> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <Pages/mytemplate.vue> at pages/mytemplate.vue
<Nuxt>
<Default> at layouts/default.vue
<Root>
据我所知,我已经正确注册了所有内容?不是这样吗?
解决方案
您是否尝试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>
另外,注册插件后,您是否重新启动了开发服务器?
推荐阅读
- sql - 为什么“ADD_YEARS”是无效标识符?
- javascript - 如果未达到最大长度,如何重新启用屏幕键盘
- python - Python中根据条件插入和删除geojson对象
- linux - 具有 1 个文件名差异的文件的输出行数
- string - 如何转义 AWK 中的所有非字母数字字符?
- php - 如何将动态数组键附加到另一个数组键
- mpic++ - 使用 MPI_Win_create_dynamic 时 MPI_Put 不起作用,为什么?
- javascript - 在某些浏览器坐标处获取元素?
- arrays - 如何在nodejs中使用nodemailer进行批量数据发送?
- postgresql - 如何从合并中删除重复项