Merge branch 'feature/loadMore' of git.dev.yoho.cn:web/yohobuy-frontend into feature/loadMore
Showing
3 changed files
with
418 additions
and
1 deletions
1 | -开发环境部署: | 1 | +# yohobuy-mobile |
2 | +--- | ||
3 | + | ||
4 | + | ||
5 | +## 开发环境部署: | ||
2 | 1. 安装node,执行npm install | 6 | 1. 安装node,执行npm install |
3 | 2. 安装spm,执行spm install | 7 | 2. 安装spm,执行spm install |
4 | 3. gulp启动服务,浏览器访问localhost:5000 | 8 | 3. gulp启动服务,浏览器访问localhost:5000 |
5 | 9 | ||
6 | 10 | ||
7 | Tip: 使用gulp build可以启动spm build服务编译好的文件存入/dist/all.js(or all-debug.js);compass在服务启动时会自动执行编译并监听文件变化。 | 11 | Tip: 使用gulp build可以启动spm build服务编译好的文件存入/dist/all.js(or all-debug.js);compass在服务启动时会自动执行编译并监听文件变化。 |
12 | + | ||
13 | + | ||
14 | +## to 想调前端代码的后端开发者 | ||
15 | + | ||
16 | +### 安装nodejs | ||
17 | + | ||
18 | +[https://nodejs.org/](https://nodejs.org/) | ||
19 | + | ||
20 | +> **注意:** 如果是mac系统记得sudo | ||
21 | + | ||
22 | +### 安装spm | ||
23 | + | ||
24 | +``` | ||
25 | +npm install -g spm | ||
26 | +``` | ||
27 | + | ||
28 | +### 安装ruby | ||
29 | + | ||
30 | +如果是mac可以略过,这个已经存在。 | ||
31 | +windows用户点击这里[http://rubyinstaller.org/](http://rubyinstaller.org/) | ||
32 | + | ||
33 | +### 设置rubygem国内源 | ||
34 | + | ||
35 | +``` | ||
36 | +gem sources --remove https://rubygems.org/ | ||
37 | +gem sources -a https://ruby.taobao.org/ | ||
38 | +gem sources -l | ||
39 | + | ||
40 | +``` | ||
41 | +### 安装compass | ||
42 | + | ||
43 | +``` | ||
44 | +gem install compass | ||
45 | +``` | ||
46 | + | ||
47 | +### 初始化项目 | ||
48 | + | ||
49 | +``` | ||
50 | +git clone http://git.dev.yoho.cn/web/yohobuy-frontend.git | ||
51 | +cd yoho-frontend/mobile | ||
52 | +npm install | ||
53 | +spm install | ||
54 | +spm doc|comapss watch | ||
55 | +``` | ||
56 | + | ||
57 | +### 打开本地的JS和css | ||
58 | +``` | ||
59 | +http://localhost:8000/examples/index.html | ||
60 | +``` | ||
61 | + | ||
62 | +### js,css调用方式 | ||
63 | + | ||
64 | +## 引用方式 | ||
65 | + | ||
66 | +### seajs的路径 | ||
67 | + | ||
68 | +````html | ||
69 | +<script src="http://localhost:8000/static/js/sea.js?nowrap"></script> | ||
70 | +```` | ||
71 | + | ||
72 | +### 配置样式表的路径 | ||
73 | +```` | ||
74 | +<link rel="stylesheet" type="text/css" href="http://localhost:8000/public/css/index.css"> | ||
75 | +```` | ||
76 | + | ||
77 | +### 配置seajs | ||
78 | + | ||
79 | +````javascript | ||
80 | + seajs.config({ | ||
81 | + base: "/" //seajs加载器的js基础路径 | ||
82 | + }); | ||
83 | +```` | ||
84 | +### 界面调用 | ||
85 | + | ||
86 | +````javascript | ||
87 | +var yohobuyMobile = seajs.use('index'); | ||
88 | +```` | ||
89 | + | ||
90 | +or | ||
91 | +````javascript | ||
92 | +var yohobuyMobile = require('index'); | ||
93 | +```` |
mobile/examples/index.md
0 → 100644
1 | +# Demo | ||
2 | + | ||
3 | +--- | ||
4 | + | ||
5 | +## 引用方式 | ||
6 | + | ||
7 | +### seajs的路径 | ||
8 | + | ||
9 | +````html | ||
10 | +<script src="../static/js/sea.js?nowrap"></script> | ||
11 | +```` | ||
12 | + | ||
13 | +### 配置样式表的路径 | ||
14 | +```` | ||
15 | +<link rel="stylesheet" type="text/css" href="../public/css/index.css"> | ||
16 | +```` | ||
17 | + | ||
18 | +### 配置seajs | ||
19 | + | ||
20 | +````javascript | ||
21 | + seajs.config({ | ||
22 | + base: "/" //seajs加载器的js基础路径 | ||
23 | + }); | ||
24 | +```` | ||
25 | +### 界面调用 | ||
26 | + | ||
27 | +````javascript | ||
28 | +var yohobuyMobile = seajs.use('index'); | ||
29 | +```` | ||
30 | + | ||
31 | +or | ||
32 | +````javascript | ||
33 | +var yohobuyMobile = require('index'); | ||
34 | +```` |
mobile/public/lib/sea-dev.js
0 → 100644
1 | +/*! Sea.js 2.3.0 | seajs.org/LICENSE.md */ ! function(a, b) { | ||
2 | + function c(a) { | ||
3 | + return function(b) { | ||
4 | + return {}.toString.call(b) == "[object " + a + "]" | ||
5 | + } | ||
6 | + } | ||
7 | + | ||
8 | + function d() { | ||
9 | + return z++ | ||
10 | + } | ||
11 | + | ||
12 | + function e(a) { | ||
13 | + return a.match(C)[0] | ||
14 | + } | ||
15 | + | ||
16 | + function f(a) { | ||
17 | + for (a = a.replace(D, "/"), a = a.replace(F, "$1/"); a.match(E);) a = a.replace(E, "/"); | ||
18 | + return a | ||
19 | + } | ||
20 | + | ||
21 | + function g(a) { | ||
22 | + var b = a.length - 1, | ||
23 | + c = a.charAt(b); | ||
24 | + return "#" === c ? a.substring(0, b) : ".js" === a.substring(b - 2) || a.indexOf("?") > 0 || "/" === c ? a : a + ".js" | ||
25 | + } | ||
26 | + | ||
27 | + function h(a) { | ||
28 | + var b = u.alias; | ||
29 | + return b && w(b[a]) ? b[a] : a | ||
30 | + } | ||
31 | + | ||
32 | + function i(a) { | ||
33 | + var b = u.paths, | ||
34 | + c; | ||
35 | + return b && (c = a.match(G)) && w(b[c[1]]) && (a = b[c[1]] + c[2]), a | ||
36 | + } | ||
37 | + | ||
38 | + function j(a) { | ||
39 | + var b = u.vars; | ||
40 | + return b && a.indexOf("{") > -1 && (a = a.replace(H, function(a, c) { | ||
41 | + return w(b[c]) ? b[c] : a | ||
42 | + })), a | ||
43 | + } | ||
44 | + | ||
45 | + function k(a) { | ||
46 | + var b = u.map, | ||
47 | + c = a; | ||
48 | + if (b) | ||
49 | + for (var d = 0, e = b.length; e > d; d++) { | ||
50 | + var f = b[d]; | ||
51 | + if (c = y(f) ? f(a) || a : a.replace(f[0], f[1]), c !== a) break | ||
52 | + } | ||
53 | + return c | ||
54 | + } | ||
55 | + | ||
56 | + function l(a, b) { | ||
57 | + var c, d = a.charAt(0); | ||
58 | + if (I.test(a)) c = a; | ||
59 | + else if ("." === d) c = f((b ? e(b) : u.cwd) + a); | ||
60 | + else if ("/" === d) { | ||
61 | + var g = u.cwd.match(J); | ||
62 | + c = g ? g[0] + a.substring(1) : a | ||
63 | + } else c = u.base + a; | ||
64 | + return 0 === c.indexOf("//") && (c = location.protocol + c), c | ||
65 | + } | ||
66 | + | ||
67 | + function m(a, b) { | ||
68 | + if (!a) return ""; | ||
69 | + a = h(a), a = i(a), a = j(a), a = g(a); | ||
70 | + var c = l(a, b); | ||
71 | + return c = k(c) | ||
72 | + } | ||
73 | + | ||
74 | + function n(a) { | ||
75 | + return a.hasAttribute ? a.src : a.getAttribute("src", 4) | ||
76 | + } | ||
77 | + | ||
78 | + function o(a, b, c) { | ||
79 | + var d = K.createElement("script"); | ||
80 | + if (c) { | ||
81 | + var e = y(c) ? c(a) : c; | ||
82 | + e && (d.charset = e) | ||
83 | + } | ||
84 | + p(d, b, a), d.async = !0, d.src = a, R = d, Q ? P.insertBefore(d, Q) : P.appendChild(d), R = null | ||
85 | + } | ||
86 | + | ||
87 | + function p(a, b, c) { | ||
88 | + function d() { | ||
89 | + a.onload = a.onerror = a.onreadystatechange = null, u.debug || P.removeChild(a), a = null, b() | ||
90 | + } | ||
91 | + var e = "onload" in a; | ||
92 | + e ? (a.onload = d, a.onerror = function() { | ||
93 | + B("error", { | ||
94 | + uri: c, | ||
95 | + node: a | ||
96 | + }), d() | ||
97 | + }) : a.onreadystatechange = function() { | ||
98 | + /loaded|complete/.test(a.readyState) && d() | ||
99 | + } | ||
100 | + } | ||
101 | + | ||
102 | + function q() { | ||
103 | + if (R) return R; | ||
104 | + if (S && "interactive" === S.readyState) return S; | ||
105 | + for (var a = P.getElementsByTagName("script"), b = a.length - 1; b >= 0; b--) { | ||
106 | + var c = a[b]; | ||
107 | + if ("interactive" === c.readyState) return S = c | ||
108 | + } | ||
109 | + } | ||
110 | + | ||
111 | + function r(a) { | ||
112 | + var b = []; | ||
113 | + return a.replace(U, "").replace(T, function(a, c, d) { | ||
114 | + d && b.push(d) | ||
115 | + }), b | ||
116 | + } | ||
117 | + | ||
118 | + function s(a, b) { | ||
119 | + this.uri = a, this.dependencies = b || [], this.exports = null, this.status = 0, this._waitings = {}, this._remain = 0 | ||
120 | + } | ||
121 | + if (!a.seajs) { | ||
122 | + var t = a.seajs = { | ||
123 | + version: "2.3.0" | ||
124 | + }, | ||
125 | + u = t.data = {}, | ||
126 | + v = c("Object"), | ||
127 | + w = c("String"), | ||
128 | + x = Array.isArray || c("Array"), | ||
129 | + y = c("Function"), | ||
130 | + z = 0, | ||
131 | + A = u.events = {}; | ||
132 | + t.on = function(a, b) { | ||
133 | + var c = A[a] || (A[a] = []); | ||
134 | + return c.push(b), t | ||
135 | + }, t.off = function(a, b) { | ||
136 | + if (!a && !b) return A = u.events = {}, t; | ||
137 | + var c = A[a]; | ||
138 | + if (c) | ||
139 | + if (b) | ||
140 | + for (var d = c.length - 1; d >= 0; d--) c[d] === b && c.splice(d, 1); | ||
141 | + else delete A[a]; | ||
142 | + return t | ||
143 | + }; | ||
144 | + var B = t.emit = function(a, b) { | ||
145 | + var c = A[a], | ||
146 | + d; | ||
147 | + if (c) { | ||
148 | + c = c.slice(); | ||
149 | + for (var e = 0, f = c.length; f > e; e++) c[e](b) | ||
150 | + } | ||
151 | + return t | ||
152 | + }, | ||
153 | + C = /[^?#]*\//, | ||
154 | + D = /\/\.\//g, | ||
155 | + E = /\/[^/]+\/\.\.\//, | ||
156 | + F = /([^:/])\/+\//g, | ||
157 | + G = /^([^/:]+)(\/.+)$/, | ||
158 | + H = /{([^{]+)}/g, | ||
159 | + I = /^\/\/.|:\//, | ||
160 | + J = /^.*?\/\/.*?\//, | ||
161 | + K = document, | ||
162 | + L = location.href && 0 !== location.href.indexOf("about:") ? e(location.href) : "", | ||
163 | + M = K.scripts, | ||
164 | + N = K.getElementById("seajsnode") || M[M.length - 1], | ||
165 | + O = e(n(N) || L); | ||
166 | + t.resolve = m; | ||
167 | + var P = K.head || K.getElementsByTagName("head")[0] || K.documentElement, | ||
168 | + Q = P.getElementsByTagName("base")[0], | ||
169 | + R, S; | ||
170 | + t.request = o; | ||
171 | + var T = /"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g, | ||
172 | + U = /\\\\/g, | ||
173 | + V = t.cache = {}, | ||
174 | + W, X = {}, | ||
175 | + Y = {}, | ||
176 | + Z = {}, | ||
177 | + $ = s.STATUS = { | ||
178 | + FETCHING: 1, | ||
179 | + SAVED: 2, | ||
180 | + LOADING: 3, | ||
181 | + LOADED: 4, | ||
182 | + EXECUTING: 5, | ||
183 | + EXECUTED: 6 | ||
184 | + }; | ||
185 | + s.prototype.resolve = function() { | ||
186 | + for (var a = this, b = a.dependencies, c = [], d = 0, e = b.length; e > d; d++) c[d] = s.resolve(b[d], a.uri); | ||
187 | + return c | ||
188 | + }, s.prototype.load = function() { | ||
189 | + var a = this; | ||
190 | + if (!(a.status >= $.LOADING)) { | ||
191 | + a.status = $.LOADING; | ||
192 | + var c = a.resolve(); | ||
193 | + B("load", c); | ||
194 | + for (var d = a._remain = c.length, e, f = 0; d > f; f++) e = s.get(c[f]), e.status < $.LOADED ? e._waitings[a.uri] = (e._waitings[a.uri] || 0) + 1 : a._remain--; | ||
195 | + if (0 === a._remain) return a.onload(), b; | ||
196 | + var g = {}; | ||
197 | + for (f = 0; d > f; f++) e = V[c[f]], e.status < $.FETCHING ? e.fetch(g) : e.status === $.SAVED && e.load(); | ||
198 | + for (var h in g) g.hasOwnProperty(h) && g[h]() | ||
199 | + } | ||
200 | + }, s.prototype.onload = function() { | ||
201 | + var a = this; | ||
202 | + a.status = $.LOADED, a.callback && a.callback(); | ||
203 | + var b = a._waitings, | ||
204 | + c, d; | ||
205 | + for (c in b) b.hasOwnProperty(c) && (d = V[c], d._remain -= b[c], 0 === d._remain && d.onload()); | ||
206 | + delete a._waitings, delete a._remain | ||
207 | + }, s.prototype.fetch = function(a) { | ||
208 | + function c() { | ||
209 | + t.request(g.requestUri, g.onRequest, g.charset) | ||
210 | + } | ||
211 | + | ||
212 | + function d() { | ||
213 | + delete X[h], Y[h] = !0, W && (s.save(f, W), W = null); | ||
214 | + var a, b = Z[h]; | ||
215 | + for (delete Z[h]; a = b.shift();) a.load() | ||
216 | + } | ||
217 | + var e = this, | ||
218 | + f = e.uri; | ||
219 | + e.status = $.FETCHING; | ||
220 | + var g = { | ||
221 | + uri: f | ||
222 | + }; | ||
223 | + B("fetch", g); | ||
224 | + var h = g.requestUri || f; | ||
225 | + return !h || Y[h] ? (e.load(), b) : X[h] ? (Z[h].push(e), b) : (X[h] = !0, Z[h] = [e], B("request", g = { | ||
226 | + uri: f, | ||
227 | + requestUri: h, | ||
228 | + onRequest: d, | ||
229 | + charset: u.charset | ||
230 | + }), g.requested || (a ? a[g.requestUri] = c : c()), b) | ||
231 | + }, s.prototype.exec = function() { | ||
232 | + function a(b) { | ||
233 | + return s.get(a.resolve(b)).exec() | ||
234 | + } | ||
235 | + var c = this; | ||
236 | + if (c.status >= $.EXECUTING) return c.exports; | ||
237 | + c.status = $.EXECUTING; | ||
238 | + var e = c.uri; | ||
239 | + a.resolve = function(a) { | ||
240 | + return s.resolve(a, e) | ||
241 | + }, a.async = function(b, c) { | ||
242 | + return s.use(b, c, e + "_async_" + d()), a | ||
243 | + }; | ||
244 | + var f = c.factory, | ||
245 | + g = y(f) ? f(a, c.exports = {}, c) : f; | ||
246 | + return g === b && (g = c.exports), delete c.factory, c.exports = g, c.status = $.EXECUTED, B("exec", c), g | ||
247 | + }, s.resolve = function(a, b) { | ||
248 | + var c = { | ||
249 | + id: a, | ||
250 | + refUri: b | ||
251 | + }; | ||
252 | + return B("resolve", c), c.uri || t.resolve(c.id, b) | ||
253 | + }, s.define = function(a, c, d) { | ||
254 | + var e = arguments.length; | ||
255 | + 1 === e ? (d = a, a = b) : 2 === e && (d = c, x(a) ? (c = a, a = b) : c = b), !x(c) && y(d) && (c = r("" + d)); | ||
256 | + var f = { | ||
257 | + id: a, | ||
258 | + uri: s.resolve(a), | ||
259 | + deps: c, | ||
260 | + factory: d | ||
261 | + }; | ||
262 | + if (!f.uri && K.attachEvent) { | ||
263 | + var g = q(); | ||
264 | + g && (f.uri = g.src) | ||
265 | + } | ||
266 | + B("define", f), f.uri ? s.save(f.uri, f) : W = f | ||
267 | + }, s.save = function(a, b) { | ||
268 | + var c = s.get(a); | ||
269 | + c.status < $.SAVED && (c.id = b.id || a, c.dependencies = b.deps || [], c.factory = b.factory, c.status = $.SAVED, B("save", c)) | ||
270 | + }, s.get = function(a, b) { | ||
271 | + return V[a] || (V[a] = new s(a, b)) | ||
272 | + }, s.use = function(b, c, d) { | ||
273 | + var e = s.get(d, x(b) ? b : [b]); | ||
274 | + e.callback = function() { | ||
275 | + for (var b = [], d = e.resolve(), f = 0, g = d.length; g > f; f++) b[f] = V[d[f]].exec(); | ||
276 | + c && c.apply(a, b), delete e.callback | ||
277 | + }, e.load() | ||
278 | + }, t.use = function(a, b) { | ||
279 | + return s.use(a, b, u.cwd + "_use_" + d()), t | ||
280 | + }, s.define.cmd = {}, a.define = s.define, t.Module = s, u.fetchedList = Y, u.cid = d, t.require = function(a) { | ||
281 | + var b = s.get(s.resolve(a)); | ||
282 | + return b.status < $.EXECUTING && (b.onload(), b.exec()), b.exports | ||
283 | + }, u.base = O, u.dir = O, u.cwd = L, u.charset = "utf-8", t.config = function(a) { | ||
284 | + for (var b in a) { | ||
285 | + var c = a[b], | ||
286 | + d = u[b]; | ||
287 | + if (d && v(d)) | ||
288 | + for (var e in c) d[e] = c[e]; | ||
289 | + else x(d) ? c = d.concat(c) : "base" === b && ("/" !== c.slice(-1) && (c += "/"), c = l(c)), u[b] = c | ||
290 | + } | ||
291 | + return B("config", a), t | ||
292 | + } | ||
293 | + } | ||
294 | +}(this);; | ||
295 | +seajs.config({ | ||
296 | + base: '/public/js' | ||
297 | +}); |
-
Please register or login to post a comment