[英]Javascript method call in requirejs project
我試圖從我項目的任何地方找到解決方法JavaScript方法調用。 我正在使用requirejs加載javascript庫。
require.config({
paths: {
fastclick: "Vendors/fastclick/lib/fastclick.js",
},
//Mention the dependencies
shim: {
fastclick: {
exports: "FastClick"
},
在這里我想這樣調用初次點擊的方法
FastClick.attach(tElement);
我不想使用requirejs define('')
這是一種無需define
即可使用的方法:
require(["fastclick"], function () {
// The shimmed module leaks `FastClick` to the global space, so this will
// work.
FastClick.attach(tElement);
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.