1 Star 0 Fork 0

CPU驱动/vuedemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
testvender.html 2.77 KB
一键复制 编辑 原始数据 按行查看 历史
wenfei ji 提交于 2017-03-27 19:40 . ceshi
<html>
<head>
<meta charset="utf8" />
</head>
<style>
</style>
<body>
<div id="app">
<form novalidate>
<input type="text" v-model="count" />
<input type="text" v-model="older.name" />
<span v-bind="count"> </span>
<span v-bind="older.name"></span>
</form>
<button v-click="testShow('1232')" >dianwo </button>
</div>
<script src="testvender.js"></script>
<script>
var dd=new Vue({
el:"#app",
data:{
count:1,
older:{
name:"扫地僧",
age:19,
}
},
methods:{
testShow:function(key){
this.count++;
console.log(this.count)
// alert(key);
}
}
});
setTimeout(function(){
dd._data.count=111;
},'10000');
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var yrr=1;
var hit = cache[str];
var ssw= hit?hit:(
cache[str] = fn(str)//fn(str)
);
return ssw
})
}
// var sd=cached((num)=>{
// console.log(num);
// return 1;
// })
// console.log(sd);
// // var sayhello=(
// // console.log("ss")
// // );
// // console.log(sayhello);
// var a={n:2};
// a.x=a={n:1};
// console.log(a.x);//?
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
return str.replace(camelizeRE, function (_, c) {
console.log(_);
return c ? c.toUpperCase() : ''; })
});
var styleObj=cached((str)=>{
return str.replace(/[A-Z]/g,function(dd){
return "-"+dd.toLowerCase();
})
})
var capitalize=cached((str)=>{
return str.charAt(0).toUpperCase()+str.slice(1);
});
//console.log(capitalize("fontsize"));
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
return str
.replace(hyphenateRE, '$1-$2')
// .replace(hyphenateRE, '$1-$2')
//.toLowerCase()
});
//console.log(hyphenate("sizFFontSizeColor"))
function extend(to,_form){
for(var key in _form){
to[key]=_form[key];
}
return to ;
}
function toObject(arr){
var res={};
for (var i=0;i<arr.length;i++){
if(arr[i]){
extend(res,arr[i]);
}
}
return res
}
console.log(toObject([{name:1213,age:121},{sex:"qq",name:"jji"}]))
function tco(f) {
var value;
var active = false;
var accumulated = [];
return function accumulator() {
debugger
accumulated.push(arguments);
if (!active) {
active = true;
while (accumulated.length) {
value = f.apply(this, accumulated.shift());
}
active = false;
return value;
}
};
}
var sum = tco(function(x, y) {
if (y > 0) {
return sum(x*y, y - 1)
}
else {
return x
}
});
//代码覆盖率工具 Istanbul
sum(1, 3)
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/jiwenfie/vuedemo.git
git@gitee.com:jiwenfie/vuedemo.git
jiwenfie
vuedemo
vuedemo
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385