【问题标题】:Loading an html page using require.js使用 require.js 加载 html 页面
【发布时间】:2013-09-18 10:06:44
【问题描述】:

我正在开发一个使用 require.js 加载脚本的 Html 应用程序。我有一个使用 jquery load() 加载的主页。

我想知道我们是否可以使用 require.js 加载 html 页面。

【问题讨论】:

    标签: requirejs


    【解决方案1】:

    文本插件是你的朋友。请参阅text plugin documentation 或blog post on that topic。

    引用前者:

    require(["some/module", "text!some/module.html", "text!some/module.css"],
        function(module, html, css) {
            //the html variable will be the text
            //of the some/module.html file
            //the css variable will be the text
            //of the some/module.css file.
        }
    );
    

    【讨论】:

      猜你喜欢
      • 2018-03-03
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 2019-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多