We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
文件结构如下: /app/index.html
/static/js/main.js /static/js/test.js
/spm_modules/jquery/2.1.3/jquery.js /spm_modules/seajs/2.3.0/dist/sea-debug.js
配置如下: 【/app/index.html 】 seajs.config({ base: '../', alias: { 'jquery': 'spm_modules/jquery/2.1.3/jquery.js' } });
// seajs.use('../static/js/main'); seajs.use('dist/test-build/0.0.0/static/js/main-debug.js', 'jquery');
【main.js 】 var $ = require('../../spm_modules/jquery/2.1.3/jquery'); var Test = require('./test');
$(function(){ var test = new Test($('.test')); test.init(); });
【test.js】 var $ = require('../../spm_modules/jquery/2.1.3/jquery');
function Test(divs){ this.divs = divs; this.bgColor = '#0ff'; }
Test.prototype.init = function(){ this.setBgColor(); };
Test.prototype.setBgColor = function(){ this.divs.each(function(i){ var self = $(this); setTimeout(function(){ self.addClass('active'); }, i * 200); }); };
module.exports = Test;
build后运行不了,望解答!
The text was updated successfully, but these errors were encountered:
建议按照官方文档走一遍:http://spmjs.io/documentation/develop-a-package
Sorry, something went wrong.
No branches or pull requests
文件结构如下:
/app/index.html
/static/js/main.js
/static/js/test.js
/spm_modules/jquery/2.1.3/jquery.js
/spm_modules/seajs/2.3.0/dist/sea-debug.js
配置如下:
【/app/index.html 】
seajs.config({
base: '../',
alias: {
'jquery': 'spm_modules/jquery/2.1.3/jquery.js'
}
});
// seajs.use('../static/js/main');
seajs.use('dist/test-build/0.0.0/static/js/main-debug.js', 'jquery');
【main.js 】
var $ = require('../../spm_modules/jquery/2.1.3/jquery');
var Test = require('./test');
$(function(){
var test = new Test($('.test'));
test.init();
});
【test.js】
var $ = require('../../spm_modules/jquery/2.1.3/jquery');
function Test(divs){
this.divs = divs;
this.bgColor = '#0ff';
}
Test.prototype.init = function(){
this.setBgColor();
};
Test.prototype.setBgColor = function(){
this.divs.each(function(i){
var self = $(this);
setTimeout(function(){
self.addClass('active');
}, i * 200);
});
};
module.exports = Test;
build后运行不了,望解答!
The text was updated successfully, but these errors were encountered: