Skip to content

Commit

Permalink
add banner
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Apr 29, 2016
1 parent bef01a5 commit 0aefcd7
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 22 deletions.
1 change: 1 addition & 0 deletions dist/avalon.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! built in 2016-4-29:17 version 2.0 by 司徒正美 */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down
1 change: 1 addition & 0 deletions dist/avalon.modern.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! built in 2016-4-29:17 version 2.0 by 司徒正美 */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down
1 change: 1 addition & 0 deletions dist/avalon.next.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! built in 2016-4-29:17 version 2.0 by 司徒正美 */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down
1 change: 1 addition & 0 deletions dist/avalon.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! built in 2016-4-29:17 version 2.0 by 司徒正美 */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down
73 changes: 55 additions & 18 deletions perf/fff.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,64 @@
<!DOCTYPE html>
<!DOCTYPE HTML>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../dist/avalon.js"></script>
<title>ms-repeat</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../dist/avalon.js" ></script>
<script>
var vm = avalon.define({

var definition = {
$id: 'test',
array: [1, 2, 3],
ddd: "<strong>222</strong>"
array: ['1', '2', '3', '4'],
removeAt: function (e) {
var elem = e.target
if (isFinite(elem.value)) {//this为input元素
var a = ~~elem.value
this.array.removeAt(a)
elem.value = ''
}
}
}
'push,unshift,remove,ensure'.replace(avalon.rword, function (method) {
definition[method] = function (e) {
//avalon2中,所有通过ms-on-* 及其变体绑定的事件,其this都是指向vm,
//而元素本身则通过e.targeta得到
var elem = e.target
if (elem.value) {
this.array[method](elem.value)
elem.value = ''
}
}
})
setTimeout(function(){
vm.ddd = "<em>333</em>"
},3000)

</script>
'pop,shift,sort,reverse'.replace(avalon.rword, function (method) {
definition[method] = function (e) {
this.array[method]()
}
})

avalon.define(definition)

</script>
</head>
<body ms-controller="test">
<div ms-for="($index, el) in @array">
{{el}}::{{$index}}
</div>
<div ms-html="@ddd">vvvv</div>
<p>监控数组拥有以下方法,我们可以操作它们就能同步对应的区域</p>
<blockquote>
push, shift, unshift, pop, slice, splice, remove, removeAt, removeAll, clear,
ensure, pushArray, sort, reverse, set
</blockquote>
<ul>
<li ms-for="($index,el) in @array">数组的第{{$index+1}}个元素为{{el}}</li>
</ul>
<p>对数组进行push操作,并回车<input ms-keypress="@push | enter"></p>
<p>对数组进行unshift操作,并回车<input ms-keypress="@unshift | enter"></p>
<p>对数组进行ensure操作,并回车<input ms-keypress="@ensure | enter"><br/>
(只有数组不存在此元素才push进去)</p>
<p>对数组进行remove操作,并回车<input ms-keypress="@remove | enter"></p>
<p>对数组进行removeAt操作,并回车<input ms-keypress="@removeAt | enter"></p>
<p><button type='button' ms-click="@sort">对数组进行sort操作</button></p>
<p><button type='button' ms-click="@reverse">对数组进行reverse操作</button></p>
<p><button type='button' ms-click="@shift">对数组进行shift操作</button></p>
<p><button type='button' ms-click="@pop">对数组进行pop操作</button></p>
<p>当前数组的长度为<span style="color:red">{{@array.length}}</span></p>

</body>
</html>
</html>
4 changes: 2 additions & 2 deletions perf/index3.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title></title>
<script src="../dist/avalon.js"></script>
<script src="../dist/avalon.modern.js"></script>
<script>
var tpl = '<div><select ms-duplex="@currentNum">' +
'<option ms-for="el in @numList">{{el}}</option>' +
Expand Down Expand Up @@ -41,6 +41,6 @@
<body ms-controller="test">
<div>{{@aaa}}</div>
<xmp ms-widget="{is:'ms-pager'}"></xmp>
<!-- <ms-pager></ms-pager>-->
<ms-pager></ms-pager>
</body>
</html>
8 changes: 6 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ text = text.replace(/version\s*\:\s*([^,]+)/, function (a, b) {
})

fs.writeFileSync('./src/seed/lang.share.js', text, 'utf8')

var now = new Date
var snow = now.getFullYear()+'-'+ (now.getMonth()+1) +
'-'+ now.getDate()+':'+ now.getHours()
module.exports = {
entry: {
avalon: './src/avalon', //我们开发时的入口文件
Expand All @@ -26,7 +28,9 @@ module.exports = {
libraryTarget: 'umd',
library: 'avalon'
}, //页面引用的文件

plugins: [
new webpack.BannerPlugin('built in '+snow+' version '+ v+' by 司徒正美')
],
module: {
loaders: [
{test: /\.jade$/, loader: 'text-loader'}
Expand Down

0 comments on commit 0aefcd7

Please sign in to comment.