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

优化代码

parent f339cbf1
......@@ -29,8 +29,8 @@ Component({
up(e) {
const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props;
const upPrize = JSON.parse(JSON.stringify(list[index-1]))
const nowPrize = JSON.parse(JSON.stringify(list[index]))
const upPrize = list[index-1]
const nowPrize = list[index]
list[index-1] = nowPrize
list[index] = upPrize
onChange && onChange(list, dataName);
......@@ -39,8 +39,8 @@ Component({
down(e) {
const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props;
const downPrize = JSON.parse(JSON.stringify(list[index+1]))
const nowPrize = JSON.parse(JSON.stringify(list[index]))
const downPrize = list[index+1]
const nowPrize = list[index]
list[index+1] = nowPrize
list[index] = downPrize
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