Commit 542c55c8 by zhangxw

特殊说明textarea高度自适应修改

1 parent 498d65dd
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<el-input v-model="contractObj['typeData'][index].contractSubjectName" :maxlength="50" @input="(event) => handleInput(event, index, 'contractSubjectName')" placeholder="请输入"></el-input> <el-input v-model="contractObj['typeData'][index].contractSubjectName" :maxlength="50" @input="(event) => handleInput(event, index, 'contractSubjectName')" placeholder="请输入"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="small" label="特别声明:" label-width="154px"> <el-form-item size="small" label="特别声明:" label-width="154px">
<el-input type="textarea" placeholder="请输入" :maxlength="200" @input="(event) => handleInput(event, index, 'contractImportantClause')" v-model="contractObj['typeData'][index].contractImportantClause"></el-input> <el-input type="textarea" placeholder="请输入" :maxlength="200" ref="contractImportantClauseInput" @input="(event) => handleInput(event, index, 'contractImportantClause')" v-model="contractObj['typeData'][index].contractImportantClause"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="small" label="合同Logo:" label-width="154px"> <el-form-item size="small" label="合同Logo:" label-width="154px">
<Upload @uploadSuccess="(event) => uploadSuccess(event, index)" :checkObj="checkObj" @delImage="(event) => delImage(event, index)" class="upload" :attr="'contractLogoUrl'" :url="contractObj['typeData'][index]['contractLogoUrl']"></Upload> <Upload @uploadSuccess="(event) => uploadSuccess(event, index)" :checkObj="checkObj" @delImage="(event) => delImage(event, index)" class="upload" :attr="'contractLogoUrl'" :url="contractObj['typeData'][index]['contractLogoUrl']"></Upload>
...@@ -264,6 +264,12 @@ export default { ...@@ -264,6 +264,12 @@ export default {
} }
} }
}, },
'contractObj.contractSubjectType': {
deep: true,
handler(val) {
this.changeContractType()
}
}
}, },
created(){ created(){
...@@ -299,6 +305,9 @@ export default { ...@@ -299,6 +305,9 @@ export default {
this.collisionRadio = '1' this.collisionRadio = '1'
this.vehicleRadio = '1' this.vehicleRadio = '1'
this.contractObj.contractSubjectType = 1 // 默认是批发 选中深圳广联数科科技有限公司 this.contractObj.contractSubjectType = 1 // 默认是批发 选中深圳广联数科科技有限公司
if (!this.showGh) {
this.adjustInputHeight()
}
} }
this.getStoreConfig() this.getStoreConfig()
}, },
...@@ -378,9 +387,19 @@ export default { ...@@ -378,9 +387,19 @@ export default {
// } // }
// this.data = storeArr // this.data = storeArr
// }, // },
changeContractType(e) {
this.$nextTick(() => {
this.adjustInputHeight()
})
},
handleInput(e, index, attr) { handleInput(e, index, attr) {
this.$set(this.contractObj.typeData[index], attr, e) this.$set(this.contractObj.typeData[index], attr, e)
this.$forceUpdate() this.$forceUpdate()
if (attr == 'contractImportantClause') {
this.$nextTick(() => {
this.adjustInputHeight()
})
}
}, },
getConfig(merchantId) { getConfig(merchantId) {
let para = { let para = {
...@@ -462,9 +481,18 @@ export default { ...@@ -462,9 +481,18 @@ export default {
contractLogoUrl: res.contractLogoUrl, contractLogoUrl: res.contractLogoUrl,
contractSealUrl: res.contractSealUrl contractSealUrl: res.contractSealUrl
} }
this.adjustInputHeight()
} }
}) })
}, },
// textarea高度自适应
adjustInputHeight() {
this.$nextTick(() => {
const input = this.$refs['contractImportantClauseInput'][0]?.$refs.textarea
input.style.height = 'auto'
input.style.height = (input.scrollHeight + 5) + 'px'
})
},
onSubmit() { onSubmit() {
// robberyServerList:[], // robberyServerList:[],
// vehicleServerList:[], // vehicleServerList:[],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!