2016-09-05 10 views
2

私の流星アプリケーションでintro.jsを使用しようとしています。流星1.4.1.1でintro.js形式のnpmパッケージを使用する方法は?

import { Template } from 'meteor/templating'; 
import { ReactiveVar } from 'meteor/reactive-var'; 
// import introJs from 'intro.js'; 
var introJs = require('intro.js'); 
import './main.html'; 

.....//some code here 

Template.hello.events({ 
    'click button'(event, instance) { 
    // increment the counter when button is clicked 
    instance.counter.set(instance.counter.get() + 1); 
    }, 

'click #introjs'(e,i){ 
    console.log("call me"); 
    introJs("#introjs").start(); 
    } 
}); 

が、私はこの問題を解決するにはどうすればよい

TypeError: introJs is not a function

を与えますか?ありがとう。

+0

私も同じ質問があります。何か見つけましたか? –

+1

検索中、私はこのhttps://github.com/zhouzhuojie/meteor-introjsリンクを得て、それが有益であるかどうかを確認してください。 –

+0

@Arjun Chaudharyいいえ私は方法を見つけようとしています。流星フォーラム[link](https://forums.meteor.com/t/not-working-bootstraptour-with-meteor-1-4/28859/6)のこの記事を参照してください –

答えて

0

htmlファイルには、イントロの処理が必要な場所で、html要素にintro要素(data-introなど)を追加する必要があります。あなたのjsファイルで

<template name=hello> 
    <a href='http://google.com/' class='introjsclass' data-intro='Hello step one!'></a> 
</template 

intro.jsをインポートし、

import { Template } from 'meteor/templating'; 
import { ReactiveVar } from 'meteor/reactive-var'; 
import introJs from 'intro.js'; 
//var introJs = require('intro.js'); 
// you have to import the introjs css file 
import '/node_modules/path to your introjs css file'; 
import './main.html'; 

.....//some code here 

Template.hello.events({ 


'click .introjsclass':function(event){ 
event.preventDefault(); 
    console.log('call me'); 
    introJs('.introjsclass').start(); 
    } 
}); 
+0

あなたの注意のために@Vinay Prabhakaranに感謝します私はこのエラーを出しています:TypeError:introJsは関数ではありません –

+0

更新された構文を試してください –

関連する問題