vue,计算属性传参, computed ,根据值不同,渲染相应的内容


     <el-table-column prop="status" label="申请状态">
        <template slot-scope="scope">
          <el-tag
            :type="getApplyStatus(scope)"
            disable-transitions
          >{{ getStatusName(scope.row.status) }}</el-tag>
        </template>
      </el-table-column>


computed: {
    getStatusName: function() {
      // `this` points to the vm instance
      return function(status) {
        if(status === '0'){
          return '未审核'
        }else if( status === '1') {
          return '已审核'
        }else if ( status === '2') {
          return '审核未通过'
        }
      };
    }
  },

猜你喜欢

转载自blog.csdn.net/A13330069275/article/details/84822203