1、组件部分(组件内部 ,涉及到子组件收到父的传值)
<template>
<el-select v-model="val" filterable clearable placeholder="请选择水井">
<el-option v-for="(option, index) in val_options" :key="index" :label="option.obj_desp" :value="option.obj_id">
</el-option>
</el-select>
</template>
<script>
import axios from 'axios'
export default {
props:['blockId', 'stationId'],
computed:{
val_options(){
let {blockId, stationId, allOptions} = this
let rs = blockId ? allOptions.filter(it=> it.block_id == blockId) : allOptions
rs = stationId ? rs.filter(it=> it.station_id == stationId) : rs
return rs
}
},