Skip to content
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