vue全局封装过滤字典表

vue全局封装过滤字典表

2021/12/13
// 过滤字典

Vue.filter('choiceCategory', function (value, list) {
  if (!value) return ''
  if (list.length) {
    for (const item of list) {
      if (value == item.dictValue) {
        return item.dictLabel;
      }
    }
  }
})
<div class="flex between addto-form-line wrap">
     <el-form-item label="需求类别:" class="flex" prop="demandCategory">
          <el-input
            :value="
              DetailForm.demandCategory | choiceCategory(selectPublishCategory)
            "
            placeholder="未填写"
            disabled
            type="textarea"
            autosize
            resize="none"
          >el-input>
    el-form-item>
div>

你可能感兴趣的:(vue,vue.js,前端,javascript,前端框架)