我正在用YUI框架编写我的第一个RoR应用程序。我试着在谷歌上搜索ror+yui手册,但没有成功。所以我去了悦点。YUI说:
// Put the YUI seed file on your page.
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>在RoR应用程序中应该放在哪里呢?
我试过app/assert/javascripts/yui-min.js。
因此,我在每一页上都有<html class="yui3-js-enabled">。假设YUI现在正在工作,我已经尝试将“使用DOM工作”的示例从叶氏页复制到app/public/index.html。
我收到的错误是:
Uncaught ReferenceError: YUI is not defined。
我试过这个链接中的信息,这对我没有帮助:
https://stackoverflow.com/questions/1452829/tutorial-suggestions-on-yui-with-ruby-on-rails
发布于 2012-05-21 16:39:11
任何rails应用程序的第一步就是删除app/public/index.html .然后在rails中的页面中工作。
因此,这意味着创建一个app/view/layout/application.html,这就是您添加
<html>
<head>
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>基于该链接,您可能在您的<head>中没有它,而且它必须是。
更新:(更改h1的javascript代码示例)
<script>
YUI().use('node', function (Y) {
var headerElement = Y.one('h1');
headerElement.setHTML("I have been updated");
});
</script>https://stackoverflow.com/questions/10687838
复制相似问题