Skip to content

@formily/vue + ant-design-vue 枚举值不显示 #1447

Discussion options

You must be logged in to vote

你需要使用 @formily/vue 提供的 connect 方法,将 field 实例上的 dataSource 属性"连接"到 Select 组件的 options 属性上。

import { Select as ASelect } from "ant-design-vue";
import { connect, mapProps } from "@formily/vue";

const Select = connect(
  ASelect,
  mapProps({
    dataSource: "options",
  })
);

参考:https://codesandbox.io/s/cocky-cloud-q8xsr?file=/src/App.vue:1355-1437

另外,这个 schema 有一些问题

  1. enum中描述的value是数字类型,所以select的type应该是number(虽然不会影响渲染)。
  2. x-component-props 中的 style 暂不支持对象写法。

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MisicDemone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants