-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
902 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
在 `D2 Crud` 组件中传入 `columns` 和 `data` 对象数组,即可创建一个最基础的表格,`columns` 中的 `key` 需要与 `data` 中对象的key严格对照,可以在 `columns` 对象中传入 `width` 属性来控制列宽。当表格中的数据通过操作变化时,可以通过 `this.$refs.d2Crud.d2Data` 拿到变化后的表格数据。代码如下: | ||
在 `D2 Crud` 组件中传入 `columns` 和 `data` 对象数组,即可创建一个最基础的表格,`columns` 中的 `key` 需要与 `data` 中对象的key严格对照,可以在 `columns` 对象中传入 `width` 属性来控制列宽。当表格中的数据通过操作变化时,可以通过 `this.$refs.d2Crud.d2CrudData` 拿到变化后的表格数据。代码如下: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
通过给 `D2 Crud` 传入 `add-mode` 可开启新增模式,需要传入 `form-template` 来为新增的表单添加模板,向`form-options` 中传入 `labelWidth` 和 `labelPosition` 来控制表单中label的显示, `saveLoading` 则控制保存按钮的loading状态,`addButton` 可以控制表格顶部新增按钮的样式, `row-add` 事件控制数据新增,接收两个参数: `row` 是当前新增行的数据, `done` 用于控制保存成功,可以在 `done()` 之前加入自己的逻辑代码,`done()`可以传入包含表单字段的对象来覆盖提交的数据,`done(false)` 可以取消新增。代码如下: | ||
通过 `ref` 调用 `D2 Crud` 的 `showDialog` 方法,并传入 `mode: 'add'`属性,可开启新增模式,需要定义 `add-template` 来为新增的表单添加模板,也可以向 `showDialog` 中传入 `template`对象来灵活定义新的模板,定义 `add-title` 来修改新增模态框的标题,向`form-options` 中传入 `labelWidth` 和 `labelPosition` 来控制表单中label的显示, `saveLoading` 则控制保存按钮的loading状态, `row-add` 事件控制数据新增,接收两个参数: `row` 是当前新增行的数据, `done` 用于控制保存成功,可以在 `done()` 之前加入自己的逻辑代码,`done()`可以传入包含表单字段的对象来覆盖提交的数据,`done(false)` 可以取消新增,通过 `ref` 调用 `D2 Crud` 的 `closeDialog` 方法可以关闭模态框。代码如下: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
通过给 `D2 Crud` 传入 `rowHandle` 可开启表格操作列,传入 `columnHeader` 可以自定义操作列的表头,传入 `edit` 对象可以开启编辑模式,需要传入 `form-template` 来为编辑添加模板,向`form-options` 中传入 `labelWidth` 和 `labelPosition` 来控制表单中label的显示, `saveLoading` 则控制保存按钮的loading状态, `row-edit` 事件控制数据编辑,参数: `index` 是当前编辑行的索引, `row` 是当前编辑行的数据, `done` 用于控制编辑成功,可以在 `done()` 之前加入自己的逻辑代码,`done()`可以传入包含表单字段的对象来覆盖提交的数据,`done(false)` 可以取消编辑。代码如下: | ||
通过给 `D2 Crud` 传入 `rowHandle` 可开启表格操作列,传入 `columnHeader` 可以自定义操作列的表头,传入 `edit` 对象可以开启编辑模式,需要传入 `edit-template` 来为编辑添加模板,通过 `ref` 调用 `D2 Crud` 的 `showDialog` 方法,并传入 `mode: 'edit'` 、`rowIndex` 属性和 `template`对象,可使用自定义模板编辑指定行,定义 `edit-title` 来修改编辑模态框的标题,向`form-options` 中传入 `labelWidth` 和 `labelPosition` 来控制表单中label的显示, `saveLoading` 则控制保存按钮的loading状态, `row-edit` 事件控制数据编辑,参数: `index` 是当前编辑行的索引, `row` 是当前编辑行的数据, `done` 用于控制编辑成功,可以在 `done()` 之前加入自己的逻辑代码,`done()`可以传入包含表单字段的对象来覆盖提交的数据,`done(false)` 可以取消编辑,通过 `ref` 调用 `D2 Crud` 的 `closeDialog` 方法可以关闭模态框。代码如下: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
向 `form-template` 的 `component` 对象传入 `name` 属性来控制渲染的组件,默认为 `el-input` ,支持的组件有 `el-input-number` `el-radio` `el-checkbox` `el-select` `el-cascader` `el-switch` `el-slider` `el-time-select` `el-time-picker` `el-date-picker` `el-rate` `el-color-picker` ,也可以使用 `render函数` 自己渲染组件,只需在 `component` 中传入 `renderFuntion` ,接收一个参数 `h`,[render函数使用方法](https://cn.vuejs.org/v2/guide/render-function.html)。代码如下: | ||
向 `add-template` 或 `edit-template` 的 `component` 对象传入 `name` 属性来控制渲染的组件,默认为 `el-input` ,支持的组件有 `el-input-number` `el-radio` `el-checkbox` `el-select` `el-cascader` `el-switch` `el-slider` `el-time-select` `el-time-picker` `el-date-picker` `el-rate` `el-color-picker` ,也可以使用 `render函数` 自己渲染组件,只需在 `component` 中传入 `renderFuntion` ,接收一个参数 `h`,[render函数使用方法](https://cn.vuejs.org/v2/guide/render-function.html)。代码如下: |
Oops, something went wrong.