Commit 1c176d77 authored by 王波's avatar 王波

容器支持表单顺序展示

parent c4121f4b
......@@ -14,7 +14,7 @@ Component({
imageLimit: [250, 250],
prizeDataType: null,
typeChecked: [],
type:''
type: ''
},
didMount() { },
didUpdate() { },
......@@ -29,20 +29,33 @@ Component({
up(e) {
const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props;
const upPrize = list[index-1]
const nowPrize = list[index]
list[index-1] = nowPrize
list[index] = upPrize
if(index === 0 ){
//最顶级往上,则移动到最后
list.splice(index,1)
list.push(nowPrize)
} else {
const upPrize = list[index - 1]
list[index - 1] = nowPrize
list[index] = upPrize
}
onChange && onChange(list, dataName);
},
down(e) {
const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props;
const downPrize = list[index+1]
const nowPrize = list[index]
list[index+1] = nowPrize
list[index] = downPrize
if(index === list.length - 1){
//最底部往下,则移动到最上面
list.splice(index,1)
list.unshift(nowPrize)
} else {
const downPrize = list[index + 1]
list[index + 1] = nowPrize
list[index] = downPrize
}
onChange && onChange(list, dataName);
},
addPrize() {
......
......@@ -8,16 +8,20 @@
<view class="edit-content">
<form class="edit-content-form" inline="true" labelTextAlign="right" labelCol="{{labelCol}}">
<% for(var i = 0; i < configList.length; ++i) {%>
<%-configList[i].template%><% } %>
<!-- 容器组件 -->
<% for(var i = 0; i < boxhtmlDatas.length; ++i) {%>
<%- `
<form-item label='${boxhtmlDatas[i].name}'>
${boxhtmlDatas[i].value}
</form-item>
`
%><% } %>
<% for(var i = 0; i < configHtmlList.length; ++i) {%>
<% if(boxhtmlDatas[i].type == 'Box')% {>
<%- `
<form-item label='${boxhtmlDatas[i].name}'>
${boxhtmlDatas[i].value}
</form-item>
`
%>
<%} else {%>
<%-configList[i].template%><% } %>
<% } %>
<% } %>
<view class="submit-btn">
<button a:if="{{!isEnd}}" onTap="onSubmit" type="primary">确定</button>
......
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