无法将jquery smartwizard npm 包与meteor 一起使用

问题描述 投票:0回答:1

我想在我的流星项目中使用 smartwizard 包。我按照安装说明进行操作,但出现错误。

我安装它时:

npm install smartwizard

将其添加到js文件中:

import "smartwizard/dist/css/smart_wizard_all.css";
import smartWizard from 'smartwizard';

为了初始化它,我将其添加到 onRendered 中:

Template.processBar.onRendered(function() {
    $('#smartwizard').smartWizard();
})

但我无法让它工作,我只是得到:

Uncaught TypeError: $(...).smartWizard is not a function

JQuery 安装在 3.7.1 版本中。 smartwizard 软件包已安装版本 6.0.6。

问题可能是什么以及如何让它工作?

jquery meteor smart-wizard
1个回答
0
投票

您需要对其进行初始化。它似乎没有被自动初始化,我没有找到它的文档。我只是检查了包的代码是如何工作的并尝试了它。

import "smartwizard/dist/css/smart_wizard_all.css";
import smartWizard from 'smartwizard'

// init outside of Templates
smartWizard($)

Template.processBar.onRendered(function() {
    $('#smartwizard').smartWizard();
})
© www.soinside.com 2019 - 2024. All rights reserved.