Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持require.js、sea.js,支持自加载语言和样式 #126

Closed
niceue opened this issue Jun 2, 2014 · 3 comments
Closed

支持require.js、sea.js,支持自加载语言和样式 #126

niceue opened this issue Jun 2, 2014 · 3 comments

Comments

@niceue
Copy link
Owner

niceue commented Jun 2, 2014

以前引入niceValidator需要3行html代码

<link href="path/to/validator/jquery.validator.css" rel="stylesheet">
<script src="path/to/validator/jquery.validator.js"></script>
<script src="path/to/validator/local/zh_CN.js"></script>

0.8开始,你可以通过3种方式引入niceValidator了,而且都只要一行代码(css会自动加载)

使用require.js模块加载器

只需要require配置文件

require(["path/to/validator/local/zh_CN"]);

使用sea.js模块加载器

只需要require配置文件

require("path/to/validator/local/zh_CN");

直接引用

注意?后面的参数local=zh_CN,决定了是否自动加载配置文件以及css文件

<script src="path/to/validator/jquery.validator.js?local=zh_CN"></script>
@niceue niceue added this to the 0.8.0 milestone Jun 2, 2014
@niceue niceue closed this as completed in 5185c0e Jun 2, 2014
@hainuo
Copy link

hainuo commented Jun 2, 2014

也开始支持require.js了,要是几个js全部自动加载就更好了,最近手头的一个项目就是require和backbone.js写的感觉真的很不错
------------------ Original ------------------
From: "Jony"notifications@github.com
Date: Mon, Jun 2, 2014 02:22 PM
To: "niceue/validator"validator@noreply.github.com;
Subject: Re: [validator] 支持require.js、sea.js,支持自加载语言和样式 (#126)

Closed #126 via 5185c0e.


Reply to this email directly or view it on GitHub.

@niceue
Copy link
Owner Author

niceue commented Jun 2, 2014

@hainuo "要是几个js全部自动加载就更好了" 是什么意思?

@hainuo
Copy link

hainuo commented Jun 5, 2014

就是一处引用,自动加载相关的js css ,手机上没看清楚,现在回来仔细看,发现你已经在第三种方法中讲了

niceue added a commit that referenced this issue Jun 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants