<ComApplicationSelect ref="shujuji" v-if="scope.row.dataType === 'dataSource'" :value.sync="scope.row.dvField" v-model="scope.row.dvField" @handlerDeptList="handlerDeptList($event, scope)" @handleDblClick="changewith(scope.row, 'changeDev')" :listId="scope.row.dataTypeParment" applicationType="dataSet" :readonly="true" :isDisabled="false" :disabled="false" :pageSize="120" :returnKeys="initKeys" :showLabel="showLabel" :storageValue="storageValue" :columns="[]" @handleListData="handleListData($event, scope.row.dvField, scope.row)"> </ComApplicationSelect> 这个修改一下:listId="scope.row.dataTypeParment" 这里传参的时候判断一下 如果scope.row.excelField==GROOVE_PROCESSING_METHOD 并且type==1 那么:listId=‘7b37ce7a5b2c4890be1faa8bf2aa7a0e’ 如果scope.row.excelField==GROOVE_PROCESSING_METHOD 并且type==2 或者3 那么:listId=‘fdb88f3ca0fc4ac39dd602b308e44cd7’

not image

在 Vue 模板中,你可以使用三元运算符结合条件判断来动态绑定 `listId` 属性。根据你的需求,当 `scope.row.excelField` 等于 `'GROOVE_PROCESSING_METHOD'` 时,根据 `scope.row.type` 的不同值来设置不同的 `listId`,否则使用 `scope.row.dataTypeParment`。 --- ### ✅ 修改后的代码如下: ```html ``` --- ### 🔍 说明: - **条件判断逻辑**: - 如果 `excelField` 是 `'GROOVE_PROCESSING_METHOD'` 且 `type` 为 `1`,则使用 `'7b37ce7a5b2c4890be1faa8bf2aa7a0e'`; - 如果 `excelField` 是 `'GROOVE_PROCESSING_METHOD'` 且 `type` 为 `2` 或 `3`,则使用 `'fdb88f3ca0fc4ac39dd602b308e44cd7'`; - 否则,使用 `scope.row.dataTypeParment`。 - **变量来源**: - `scope.row.excelField` 和 `scope.row.type` 均来自 `scope.row`,符合 Vue 的作用域绑定习惯。 --- ### 📌 建议(可选): 如果逻辑进一步复杂化,建议将判断逻辑提取到一个**计算属性**或**方法**中,以提高可读性和可维护性。例如: ```html :listId="getListId(scope.row)" ``` ```js methods: { getListId(row) { if (row.excelField === 'GROOVE_PROCESSING_METHOD') { if (row.type === 1) return '7b37ce7a5b2c4890be1faa8bf2aa7a0e'; if (row.type === 2 || row.type === 3) return 'fdb88f3ca0fc4ac39dd602b308e44cd7'; } return row.dataTypeParment; } } ``` 这样可以让模板更简洁,逻辑更清晰。

评论区:

评论:

请输入内容: