pertersonvv
V2EX  ›  问与答

requirejs 一个模块只能定义一个函数么?

  •  
  •   pertersonvv · Jan 1, 2015 · 2716 views
    This topic created in 4149 days ago, the information mentioned may be changed or developed.

    a.js

    define(['./b', './c'], function(){
    sss
    });

    这个文件定义了一个名字为a的函数么?

    yyfearth
        1
    yyfearth  
       Jan 1, 2015
    看看网上的文档和教程吧 感觉你是完全不懂啊
    你可以在一个js里面define或者require多个 但是这样意义不大 就像java里面一个文件就一个class一样

    另外 function 里面是可以有 随便嵌套 function的
    最外层的这个只是保证你依赖的js文件载入后再执行里面的代码
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5636 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 143ms · UTC 07:30 · PVG 15:30 · LAX 00:30 · JFK 03:30
    ♥ Do have faith in what you're doing.