繁体   English   中英

requirejs项目中的Javascript方法调用

[英]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.

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