全量导入
组件数轻松上20, 我已经没有耐心使用按需导入了。
暴力 import Antd from "ant-design-vue" 提示Antd找不到~, 解决办法: 把babel.config.js中的下面这段删除,
plugins: [["import",{libraryName: "ant-design-vue",libraryDirectory: "es",style: true,},],],然后~~
importVuefrom"vue";importAntdfrom"ant-design-vue";import"ant-design-vue/dist/antd.less";Vue.prototype.$message=Antd.message;Vue.prototype.ok=function(message){this.$message.success(message||"Success.");};Vue.use(Antd);table 中的boolean字段不能显示值
弄个customRender.
<template>
<a-table:columns="mycolumns":dataSource="tasks":pagination="false"rowKey="id"size="small"
>
<spanslot="index"slot-scope="text, record, index">{{ index + 1 }}</span>
<template slot="auto" slot-scope="text">{{ text.toString() }}</template>
</template>
<script>exportdefault {data: { mycolumns: [ { title:"#", dataIndex:"index", scopedSlots: { customRender:"index" }, align:"center", width:"5%", }, { title:"Auto", dataIndex:"auto", scopedSlots: { customRender:"auto" }, }, ]}checkbox 设置初值 要 指定 valuePropName 为 checked
<a-row><a-col:span="12"><a-form-itemv-bind="formItemLayout" label="Active" :colon="false"><a-checkboxv-decorator="[ 'active', { valuePropName: 'checked', initialValue: formData.active }, ]"
@change="checkActive($event.target.checked)"
> </a-checkbox></a-form-item></a-col></a-row>You cannot set a form field before rendering a field associated with the value.
出现这个错误的原因:
- 没写
<a-form-item> 标签! - fieldName写错了
this.form.setFieldsValue({ fieldName1: 0, fieldName2: [1, 2] });
全量导入
组件数轻松上20, 我已经没有耐心使用按需导入了。
暴力
import Antd from "ant-design-vue"提示Antd找不到~, 解决办法: 把babel.config.js中的下面这段删除,然后~~
table 中的boolean字段不能显示值
弄个customRender.
checkbox 设置初值 要 指定 valuePropName 为 checked
You cannot set a form field before rendering a field associated with the value.
出现这个错误的原因:
<a-form-item>标签!this.form.setFieldsValue({ fieldName1: 0, fieldName2: [1, 2] });