Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task19 发送交易表单增加选择空字符串复选框按钮 #506

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/components/sendTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@
<el-form class="send-item" v-show="form.pramasData.length" style="line-height: 25px" :rules="rules" :model="form" ref="sendTransation">
<span class="send-item-title" style="position: relative; top: 5px">{{ this.$t("contracts.params") }}:</span>
<div v-for="(item, index) in form.pramasData" :key='index'>
<el-form-item style="position: relative; top: -25px" :prop="'pramasData.'+index+'.value'" :rules='rules[item.type]'>
<el-form-item style="position: relative; top: -25px" :prop="'pramasData.'+index+'.value'" :rules='!item.isNullFlag ? rules[item.type] : changeRules(item, index)'>
<span class="send-item-title"></span>
<template v-if="item.type == 'string'">
<template v-if="item.type == 'string' || item.type == 'bytes'">
<el-input v-model="item.value" style="width: 400px" :placeholder="item.type">
<template slot="prepend">
<span class="">{{ item.name }}</span>
</template>
<template slot="suffix">
<el-checkbox style="position: relative; top: 5px;" size="mini" @change="item.isNullFlag = !item.isNullFlag" label="勾选传递空值"></el-checkbox>
</template>
</el-input>
</template>
<template v-else>
Expand Down Expand Up @@ -449,10 +452,24 @@ export default {
this.changeType();
}
},
changeRules: function(item, index) {
if(item.type == "string") {
this.$set(this.form.pramasData[index], "value", "");
return [];
}else if(item.type == "bytes") {
this.$set(this.form.pramasData[index], "value", "0x");
return [];
}
},
changeFunc: function () {
this.constant = false;
this.funcList.forEach((value) => {
if (value.funcId === this.transation.funcName) {
value.inputs.forEach((item) => {
if(item.type === "string" || item.type === "bytes") {
this.$set(item, 'isNullFlag',false);
}
});
this.form.pramasData = value.inputs;
if (
value.stateMutability == "view" ||
Expand Down