Comparing version 2.0.12 to 2.0.13
@@ -402,5 +402,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
Template.prototype.set = function(key, value, doneOrAsync) { | ||
var isChange; | ||
if (doneOrAsync == null) { | ||
doneOrAsync = null; | ||
} | ||
isChange = this.scope[key] !== value; | ||
this.scope[key] = value; | ||
@@ -410,4 +412,6 @@ if (this._status === 0) { | ||
} | ||
this.emit('changeScope', this.scope, key, value); | ||
this.emit('change:' + key, value); | ||
if (isChange) { | ||
this.emit('changeScope', this.scope, key, value); | ||
this.emit('change:' + key, value); | ||
} | ||
return this.renderQueue(doneOrAsync); | ||
@@ -472,2 +476,3 @@ }; | ||
Template.prototype.destroy = function() { | ||
this.emit('destroy'); | ||
if (this.refs && this.refs.parentNode && this.refs.parentNode.removeChild) { | ||
@@ -502,3 +507,3 @@ this.refs.parentNode.removeChild(this.refs); | ||
Template.prototype.render = function(virtualDomDefine, scope, doneOrAsync) { | ||
var ix, scopeKeys, scopeLen; | ||
var scopeKeys, scopeLen; | ||
this.virtualDomDefine = virtualDomDefine; | ||
@@ -518,8 +523,8 @@ if (scope == null) { | ||
} else { | ||
ix = scopeLen - 1; | ||
each(scopeKeys, (function(_this) { | ||
return function(v, k) { | ||
return _this.set(v, scope[v], k === ix && doneOrAsync || null); | ||
return function(v) { | ||
return _this.set(v, scope[v]); | ||
}; | ||
})(this)); | ||
this.renderQueue(doneOrAsync); | ||
} | ||
@@ -533,2 +538,3 @@ return this; | ||
virtualDom = this.virtualDomDefine(scope, this).virtualDom; | ||
this._status = 2; | ||
if (this.virtualDom === null) { | ||
@@ -546,3 +552,3 @@ this.virtualDom = virtualDom; | ||
} | ||
this._status = 2; | ||
this._status = 3; | ||
this.emit('rendered', this.refs); | ||
@@ -1803,3 +1809,9 @@ if (isFunction(done)) { | ||
exports['selected'] = { | ||
rendered: function(el, value) { | ||
return el.value = value; | ||
} | ||
}; | ||
/* | ||
@@ -1905,2 +1917,3 @@ ## mc-* | ||
this._isInit = false; | ||
this._plus(); | ||
this.init(); | ||
@@ -1910,2 +1923,4 @@ this.watch(); | ||
Component.prototype._plus = function() {}; | ||
Component.prototype.init = function() {}; | ||
@@ -1912,0 +1927,0 @@ |
@@ -12,7 +12,18 @@ { | ||
"devDependencies": { | ||
"autoprefixer-loader": "^3.2.0", | ||
"coffee-loader": "^0.7.2", | ||
"coffee-script": "^1.10.0", | ||
"h2svd-loader": "^1.0.11", | ||
"css-loader": "^0.23.1", | ||
"del": "^2.2.0", | ||
"extract-text-webpack-plugin": "^1.0.1", | ||
"file-loader": "^0.8.5", | ||
"glob": "^7.0.0", | ||
"h2svd-loader": "^1.0.13", | ||
"iconfontcn-loader": "^1.0.1", | ||
"mcoreapp": "^2.0.12", | ||
"sass-loader": "^3.1.2", | ||
"style-loader": "^0.13.0", | ||
"url-loader": "^0.5.7", | ||
"webpack": "^1.12.12" | ||
} | ||
} |
@@ -0,12 +1,18 @@ | ||
require('coffee-script/register'); | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
var buildHtml = require('./tool/buildHtml'); | ||
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
// h2svd-loader | ||
require('h2svd-loader'); | ||
module.exports = { | ||
entry: './js/src/app/index.js', | ||
staticPath: '.', | ||
env: 'dev', | ||
entry: { | ||
app: path.join(__dirname, './js/src/app/index') | ||
}, | ||
output: { | ||
path: __dirname + '/js/dist', | ||
filename: 'app.js', | ||
libraryTarget: 'umd' | ||
publicPath: '/build/dev/', | ||
path: path.join(__dirname, 'build/dev/'), | ||
filename: '[name].all.js', | ||
}, | ||
@@ -16,6 +22,18 @@ module: { | ||
test: /\/tpl\/.*(\.html)$/, | ||
loader: 'h2svd-loader' | ||
loader: 'h2svd-loader?mcoreName=mcoreapp' | ||
}, { | ||
test: /\.coffee$/, | ||
loader: "coffee-loader" | ||
}, { | ||
test: /\.(jpe?g|png|gif|svg)$/i, | ||
loader: 'url-loader?limit=10000&name=img/[hash:8].[name].[ext]' | ||
}, { | ||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, | ||
loader: "url-loader?limit=10000&name=font/[hash:8].[name].[ext]&mimetype=application/font-woff" | ||
}, { | ||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, | ||
loader: "url-loader?limit=10000&name=font/[hash:8].[name].[ext]" | ||
}, { //放最后,用于其它环境build时,替换 | ||
test: /\.scss$/, | ||
loader: ExtractTextPlugin.extract('style-loader', 'css?sourceMap!autoprefixer!sass?sourceMap') | ||
}] | ||
@@ -28,4 +46,2 @@ }, | ||
alias: { | ||
mcore: __dirname + '/../../dist/mcore.js', | ||
mcoreApp: __dirname + '/../../dist/mcoreApp.js' | ||
} | ||
@@ -35,3 +51,56 @@ }, | ||
jquery: 'jQuery' | ||
} | ||
}, | ||
devtool: "source-map", | ||
plugins: [ | ||
buildHtml({ | ||
tplPath: path.join(__dirname, './outTpl/*.html'), | ||
out: __dirname, | ||
varMap: { | ||
staticPath: function() { | ||
return module.exports.staticPath; | ||
}, | ||
env: function() { | ||
return module.exports.env; | ||
} | ||
} | ||
}), | ||
//放最后,用于其它环境build时,替换 | ||
new ExtractTextPlugin('style/[name].min.css') | ||
] | ||
}; | ||
module.exports.buildEnv = function(envName, staticPath) { | ||
//静态资源域名 | ||
config.staticPath = staticPath || '.'; | ||
config.devtool = ''; | ||
config.env = envName; | ||
config.output.publicPath = config.staticPath + '/build/' + envName + '/'; | ||
config.output.path = path.join(__dirname, './build/' + envName); | ||
config.output.filename = '[name].[chunkhash].js'; | ||
//重写 sass loader | ||
config.module.loaders.pop(); | ||
config.module.loaders.push({ | ||
test: /\.scss$/, | ||
loader: ExtractTextPlugin.extract('style-loader', 'css!autoprefixer!iconfontcn!sass') | ||
}); | ||
//config.resolve.alias.env = path.join(__dirname, './js/src/env/' + envName); | ||
config.plugins.pop(); | ||
config.plugins.push(new ExtractTextPlugin('style/[name].[chunkhash].css')); | ||
config.plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
); | ||
return config; | ||
}; |
{ | ||
"name": "mcoreapp", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"description": "simple MVVM", | ||
@@ -23,6 +23,4 @@ "main": "dist/mcoreApp.js", | ||
"homepage": "https://github.com/vfasky/mcore/tree/2.0#readme", | ||
"dependencies": { | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"path-to-regexp": "^1.2.1", | ||
"coffee-loader": "^0.7.2", | ||
@@ -32,8 +30,6 @@ "coffee-script": "^1.10.0", | ||
"h2svd-loader": "^1.0.0", | ||
"htmlparser2": "^3.9.0", | ||
"list-diff2": "^0.1.4", | ||
"loader-utils": "^0.2.12", | ||
"object.observe": "^0.2.6", | ||
"path-to-regexp": "^1.2.1", | ||
"webpack": "^1.12.10" | ||
} | ||
} |
@@ -24,3 +24,3 @@ /** | ||
alias: { | ||
mcore: __dirname + '/dist/mcore.js' | ||
mcore: __dirname + '/dist/mcore.js', | ||
} | ||
@@ -27,0 +27,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1315576
7
82
18164