use a variable to store the switch of the disabled attribute in the instance, and then determine whether disabled is true or when disabled equals false in the false, page, but it is still disabled in the page, that is, setting false has no effect
the following two files belong to the sibling relationship, because the data of a file is needed, all of which are sent through $emit and received by $on
<el-button type="primary" icon="el-icon-edit" @click="skipPatrolPlanEdit()"></el-button>
import { Event, KEY } from "../../../../../utils/event.js"
methods: {
skipPatrolPlanEdit() {
let publishedText = this.multipleSelection[0].publishedText;
//
Event.$emit(KEY, publishedText);
}
}
another sibling page
<el-form-item label="" required>
<el-col :span="11">
<el-form-item prop="startTime">
<el-date-picker type="datetime" :disabled="disabledEdit" placeholder="" v-model="ruleForm.startTime" value-format="yyyy-MM-dd HH:mm:ss" style="width: 100%;" @change="getTime" :picker-options="pickerBeginDateBefore"> </el-date-picker>
</el-form-item>
</el-col>
<el-col class="line" :span="2">-</el-col>
<el-col :span="11">
<el-form-item prop="endTime">
<el-date-picker type="datetime" :disabled="disabledEdit" placeholder="" v-model="ruleForm.endTime" style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" @change="getTime" :picker-options="pickerBeginDateAfter"> </el-date-picker>
</el-form-item>
</el-col>
</el-form-item>
data() {
return {
// false
disabledEdit: false,
}
},
created() {
Event.$on(KEY, val => {
// $emitdisabled
if (val == "") {
this.disabledEdit = true;
console.log("this.disabledEdit", this.disabledEdit);
}
});
}
here is the print message and page display