/
input.html
75 lines (72 loc) · 2.23 KB
/
input.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">
<div v-for="(row,index) in tableData">
<template cope="row">
<input type="text" :value="row.name" @change="change(row,$event.target.value,index)">
{{index}}
</template>
</div>
</div>
<script>
let data = new Vue({
el:"#app",
data:{
tableData: [{
date: '2016-05-02',
name: '1',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '2',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '3',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '4',
address: '上海市普陀区金沙江路 1516 弄'
}]
},
methods:{
change:function (row,val,index) {
if(val>1){
this.tableData[index].name="";
}else {
this.tableData[index].name=val
}
},
a(){
var maxSequence = function(arr){
let max = {x:0,y:0,max:0}
for(let i =0,len=arr.length;i<len;i++){
let sum = i;
for(let y=i+1;y<len;y++){
sum+=y;
if(sum>max.max){
max.max = sum;
max.y = y;
}
}
}
arr.splice(max.x,max.y-max.x+1);
return arr;
}
}
}
})
</script>
</body>
</html>