fix gulp scaffold bug

This commit is contained in:
kmdjs 2016-04-24 20:15:08 +08:00
parent a619276f2c
commit 3273264676
14 changed files with 80 additions and 33 deletions

3
dist/nuclear.js vendored
View File

@ -29,7 +29,8 @@ Nuclear.create = function (obj) {
Nuclear._mixObj = function (obj) {
obj.ctor = function (option, selector) {
this._ncInstanceId=Nuclear.getInstanceId();
Nuclear.instances[this._ncInstanceId] = this;
//加window防止构建到webpack中Nuclear是局部而非全局
window.Nuclear.instances[this._ncInstanceId] = this;
this._nuclearParentEmpty = !selector;
this.HTML = "";
this.option = option;

2
dist/nuclear.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,8 @@ Nuclear.create = function (obj) {
Nuclear._mixObj = function (obj) {
obj.ctor = function (option, selector) {
this._ncInstanceId=Nuclear.getInstanceId();
Nuclear.instances[this._ncInstanceId] = this;
//加window防止构建到webpack中Nuclear是局部而非全局
window.Nuclear.instances[this._ncInstanceId] = this;
this._nuclearParentEmpty = !selector;
this.HTML = "";
this.option = option;
@ -213,7 +214,7 @@ Nuclear._mixObj = function (obj) {
var item = this._nuclearRenderInfo, rpLen = item.refreshPart.length;
item.tpl = this._nuclearTplGenerator();
if (rpLen > 0) {
var parts = Nuclear.str2Dom(this._nuclearWrap(Nuclear.Tpl.render(Nuclear._fixEvent(Nuclear._fixTplIndex(item.tpl), this._ncInstanceId), item.data)).querySelectorAll('*[nc-refresh]'));
var parts = Nuclear.str2Dom(this._nuclearWrap(Nuclear.Tpl.render(Nuclear._fixEvent(Nuclear._fixTplIndex(item.tpl), this._ncInstanceId), item.data))).querySelectorAll('*[nc-refresh]');
window["_nuclearIndex"] = null;
for (var j = 0; j < rpLen; j++) {
var part = item.refreshPart[j];

View File

@ -44,15 +44,20 @@
/* 0 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
var _index = __webpack_require__(1);
var _index2 = _interopRequireDefault(_index);
var _index3 = __webpack_require__(3);
var _index4 = _interopRequireDefault(_index3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
new _index2.default({ name: "Nuclear" }, "#es6");
new _index2.default({ items: [] }, "#es6");
new _index4.default({ items: [] }, "#hello");
/***/ },
/* 1 */
@ -124,7 +129,8 @@
Nuclear._mixObj = function (obj) {
obj.ctor = function (option, selector) {
this._ncInstanceId = Nuclear.getInstanceId();
Nuclear.instances[this._ncInstanceId] = this;
//加window防止构建到webpack中Nuclear是局部而非全局
window.Nuclear.instances[this._ncInstanceId] = this;
this._nuclearParentEmpty = !selector;
this.HTML = "";
this.option = option;
@ -309,7 +315,7 @@
rpLen = item.refreshPart.length;
item.tpl = this._nuclearTplGenerator();
if (rpLen > 0) {
var parts = Nuclear.str2Dom(this._nuclearWrap(Nuclear.Tpl.render(Nuclear._fixEvent(Nuclear._fixTplIndex(item.tpl), this._ncInstanceId), item.data)).querySelectorAll('*[nc-refresh]'));
var parts = Nuclear.str2Dom(this._nuclearWrap(Nuclear.Tpl.render(Nuclear._fixEvent(Nuclear._fixTplIndex(item.tpl), this._ncInstanceId), item.data))).querySelectorAll('*[nc-refresh]');
window["_nuclearIndex"] = null;
for (var j = 0; j < rpLen; j++) {
var part = item.refreshPart[j];
@ -1286,6 +1292,36 @@
return Nuclear;
});
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _nuclear = __webpack_require__(2);
var _nuclear2 = _interopRequireDefault(_nuclear);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var HelloMessage = _nuclear2.default.create({
say: function say() {
alert("Hello Nuclear!");
},
style: function style() {
return "div{\n color:green;\n cursor:pointer;\n }";
},
render: function render() {
return "<div onclick=\"say()\">Click Me ,Please!</div>";
}
});
exports.default = HelloMessage;
/***/ }
/******/ ]);
//# sourceMappingURL=bundle.js.map

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,7 @@
<title>脚手架</title>
</head>
<body>
<div id="hello"></div>
<div id="es6"></div>
<script src="bundle.js"></script>
</body>

View File

@ -14,11 +14,11 @@ var ES6TodoApp = Nuclear.create({
<button>Add #{{items.length}}</button>
</form>
</div>`;
},
style: function () {
return `h3 { color:red; }
},
style: function () {
return `h3 { color:red; }
button{ color:green;}`;
}
}
});
export default ES6TodoApp;

View File

@ -0,0 +1,18 @@
import Nuclear from "../../lib/nuclear.js"
var HelloMessage = Nuclear.create({
say:function(){
alert("Hello Nuclear!");
},
style:function(){
return `div{
color:green;
cursor:pointer;
}`;
},
render: function () {
return `<div onclick="say()">Click Me ,Please!</div>`;
}
});
export default HelloMessage;

View File

@ -5,10 +5,8 @@
<title>脚手架</title>
</head>
<body>
<div id="hello"></div>
<div id="es6"></div>
<div id="helloContainer"></div>
<div id="timerContainer"></div>
<div id="todoListContainer"></div>
<script src="js/main.js"></script>
<script src="bundle.js"></script>
</body>
</html>

View File

@ -1,4 +1,5 @@
import ES6TodoApp from '../component/es6_test/index.js';
import HelloMessage from '../component/hello/index.js';
new ES6TodoApp ({ name: "Nuclear" }, "#es6");
new ES6TodoApp ({ items: [] }, "#es6");
new HelloMessage ({ items: [] }, "#hello");

View File

@ -1,11 +0,0 @@
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toString() {
return `(${this.x}, ${this.y})`;
}
}
export default Point;

View File

@ -29,7 +29,8 @@ Nuclear.create = function (obj) {
Nuclear._mixObj = function (obj) {
obj.ctor = function (option, selector) {
this._ncInstanceId=Nuclear.getInstanceId();
Nuclear.instances[this._ncInstanceId] = this;
//加window防止构建到webpack中Nuclear是局部而非全局
window.Nuclear.instances[this._ncInstanceId] = this;
this._nuclearParentEmpty = !selector;
this.HTML = "";
this.option = option;
@ -213,7 +214,7 @@ Nuclear._mixObj = function (obj) {
var item = this._nuclearRenderInfo, rpLen = item.refreshPart.length;
item.tpl = this._nuclearTplGenerator();
if (rpLen > 0) {
var parts = Nuclear.str2Dom(this._nuclearWrap(Nuclear.Tpl.render(Nuclear._fixEvent(Nuclear._fixTplIndex(item.tpl), this._ncInstanceId), item.data)).querySelectorAll('*[nc-refresh]'));
var parts = Nuclear.str2Dom(this._nuclearWrap(Nuclear.Tpl.render(Nuclear._fixEvent(Nuclear._fixTplIndex(item.tpl), this._ncInstanceId), item.data))).querySelectorAll('*[nc-refresh]');
window["_nuclearIndex"] = null;
for (var j = 0; j < rpLen; j++) {
var part = item.refreshPart[j];

View File

@ -11,7 +11,8 @@ Nuclear.create = function (obj) {
Nuclear._mixObj = function (obj) {
obj.ctor = function (option, selector) {
this._ncInstanceId=Nuclear.getInstanceId();
Nuclear.instances[this._ncInstanceId] = this;
//加window防止构建到webpack中Nuclear是局部而非全局
window.Nuclear.instances[this._ncInstanceId] = this;
this._nuclearParentEmpty = !selector;
this.HTML = "";
this.option = option;