简体   繁体   English

初始化时出现流星表格错误

[英]Meteor Tabular errors on initialization

I'm following along the guide to setup Meteor Tabular v2.1.2 ( guide ).我正在按照指南设置 Meteor Tabular v2.1.2(指南)。 I have added the package and installed the theming packages.我已经添加了包并安装了主题包。 I'm using Meteor v2.8.0 and the project is a Blaze-based project.我正在使用 Meteor v2.8.0,该项目是一个基于 Blaze 的项目。

In client/main.js , I set up the library as instructed.client/main.js中,我按照说明设置了库。

 import { $ } from 'meteor/jquery'; import dataTablesBootstrap from 'datatables.net-bs'; import 'datatables.net-bs/css/dataTables.bootstrap.css'; import "../imports/ui/body"; dataTablesBootstrap(window, $);

Now when I go to the browser, there is this error:现在,当我转到浏览器时,出现此错误: 浏览器错误

Can anyone help me on this?谁可以帮我这个事?

So after serious debugging, I discovered it is enough to just import the DataTable module as such after installing it with npm所以经过认真调试,我发现用npm安装后直接导入DataTable模块就足够了

    import { $ } from 'meteor/jquery';
    import 'datatables.net-bs';
    import 'datatables.net-bs/css/dataTables.bootstrap.css';

    import "../imports/ui/body";

//  You don't need the code previously here . 

You can now setup you DataTable as such您现在可以这样设置 DataTable

$(element).DataTable(//Your config object)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM