如何在 YUI 3 中加载自定义 js 脚本
我是 Web 开发的新手,但已经使用 YUI 几个月了。谁能告诉我如何在 YUI 3 中加载自定义“js”脚本?
我想在 YUI 3 中使用“contentflow”轮播。 为此,我需要在其中包含 contentflow.js “YUI.use()”以便我可以访问这些方法。
I am a newbie to web development but have been playing around with YUI for a few months now. Can anyone let me know how to load a custom "js" script in YUI 3?
I want to use the "contentflow" carousel in YUI 3. For this i need to include the contentflow.js within the "YUI.use()" so that I can access the methods.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要添加模块(以便 YUI 识别它),您需要将其添加到配置中。有三种方法可以做到这一点。
YUI_config = {};
为所有YUI().use
设置全局配置对象YUI.GlobalConfig = {};
设置全局所有YUI().use
的配置对象YUI({}).use(...;
设置此YUI() 的本地配置对象。使用
在config对象中你需要配置模块 然后您可以这样
做:
但是我建议在内容流 JavaScript 中使用
YUI.add
方法来公开contentFlow 中的内容流“类”。 在Node.js
中,我将包装以下内容:然后您可以:
To add a module (so that YUI recognises it) you need to add it to the configuration. There are three ways of doing this.
YUI_config = {};
sets a global configuration object for allYUI().use
YUI.GlobalConfig = {};
sets a global configuration object for allYUI().use
YUI({}).use(...;
sets a local configuration object for thisYUI().use
In the config object you need to configure the module to be understood in your use.
Then you can do:
However I would recommend using the
YUI.add
method in the content flow JavaScript to expose the content flow "class". So incontentFlow.js
, I would wrap the following:Then you can:
来源: https://clarle.github.io/yui3/yui/docs/get /
Source: https://clarle.github.io/yui3/yui/docs/get/