<template slot-scope="scope">
<state :type="getStateObject(scope.row.state).type" :text="getStateObject(scope.row.state).value"></state>
</template>
const getStateObject = (state) => {
// debugger
return STATE.filter((item) => +item.key === +state)[0];
};
不知道你要优化什么,希望能写清楚点,不要让我们猜,如果是想优化写法,我想到一更优雅的写法: