Commit 9d3caf16 authored by 王波's avatar 王波

优化代码

parent f339cbf1
...@@ -29,8 +29,8 @@ Component({ ...@@ -29,8 +29,8 @@ Component({
up(e) { up(e) {
const index = e.target.dataset.idx; const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props; const { onChange, list, dataName } = this.props;
const upPrize = JSON.parse(JSON.stringify(list[index-1])) const upPrize = list[index-1]
const nowPrize = JSON.parse(JSON.stringify(list[index])) const nowPrize = list[index]
list[index-1] = nowPrize list[index-1] = nowPrize
list[index] = upPrize list[index] = upPrize
onChange && onChange(list, dataName); onChange && onChange(list, dataName);
...@@ -39,8 +39,8 @@ Component({ ...@@ -39,8 +39,8 @@ Component({
down(e) { down(e) {
const index = e.target.dataset.idx; const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props; const { onChange, list, dataName } = this.props;
const downPrize = JSON.parse(JSON.stringify(list[index+1])) const downPrize = list[index+1]
const nowPrize = JSON.parse(JSON.stringify(list[index])) const nowPrize = list[index]
list[index+1] = nowPrize list[index+1] = nowPrize
list[index] = downPrize list[index] = downPrize
onChange && onChange(list, dataName); onChange && onChange(list, dataName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment