as shown in figure 1, in the first drop-down selection, the second select is dynamically assigned,
select
I"m a little confused. During the novice trial, I don"t know how to clear the second
when the first select changes. as shown in figure 1, in the first drop-down selection, the second select is dynamically assigned,
select
I"m a little confused. During the novice trial, I don"t know how to clear the second
when the first select changes.listen for changes to the first select and change the value of the second select to null
use watch, like this
data(){
return {
form:{
select1:null,
select2:null
}
}
},
watch: {
'form.select1': function (newValue, oldValue) {
this.form.select2 = null
}
},
methods:{
...
}
/ / emptying method (solves the problem that the value of the second select cannot be selected after emptying the first selection box value)
methods: {
resetValue(){
this.$set(this.form, 'select1', '')
}
}
listens for the change event of the first seelect, clears the value of the second select binding, or assigns the first
just add a judgment to the value that needs to be cleared:
eg:
<el-form-item label="" prop="project_team_id">
<el-select v-model="pageData.project_team_id"
placeholder=""
clearable
@change="project_team_change"
>
<el-option v-for="item in project_team_code_list"
:key="item._id"
:label="item.project_team_name"
:value="item._id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="project_id">
<el-select v-model="pageData.project_id"
placeholder=""
clearable
>
<el-option v-for="item in project_code_list"
:key="item._id"
:label="item.project_name"
:value="item._id">
</el-option>
</el-select>
</el-form-item>
async project_team_change (project_team_id) {
this.project_code_list = await this.$getProjectCodeInfo({'project_team_id': project_team_id});
if (this.pageData.project_id) {
this.pageData.project_id = '';
}
},
< hr >
Note:
/ / if (this.pageData.project_id) {
/ / let fields = this.$refs ['pageDataRef'] .fields;
/ / for (let i = 0; I < fields.length; iPP) {
/ / if (fields.prop =' project_id') {
/ / fields.fields ();
/ / break;
/ /}
original writing, later found that it does not need to be so complicated, only need to judge in the first assignment, it is best to judge not empty
Previous: Webview page plays local video
Next: Modified aps.cs file, restart iis will not take effect? Find a plan
if a table looks like the figure above, the subtotal is calculated by yourself. Title 1, title 2 can be sorted by clicking, but the sorting should be kept subtotal, and the total position remains the same I have tried several methods tableData pus...