签入版本
This commit is contained in:
@@ -125,7 +125,7 @@ $field = [
|
||||
'in_list' => true, // 是否进列表
|
||||
'filterable' => false, // 是否可筛选
|
||||
'filter_type' => '', // 筛选方式:'精确匹配' / '' / '模糊'
|
||||
'choices' => [ // 选项列表(有值时可生成 ElTag 渲染)
|
||||
'choices' => [ // 选项列表(有值时可生成 NTag 渲染)
|
||||
['value' => 0, 'label' => '正常', 'type' => 'success'],
|
||||
['value' => 1, 'label' => '禁用', 'type' => 'danger'],
|
||||
],
|
||||
@@ -177,18 +177,18 @@ class <?php echo $model_class_name ?>Service extends <?php echo $is_tree ? 'Base
|
||||
|
||||
```typescript
|
||||
import { h } from 'vue';
|
||||
import { ElAvatar, ElTag } from 'element-plus';
|
||||
import { NTag, NAvatar } from 'naive-ui';
|
||||
|
||||
export const columns = [
|
||||
{ type: 'selection' },
|
||||
{ label: 'ID', prop: 'id', fixed: 'left', width: 50 },
|
||||
{ title: 'ID', key: 'id', fixed: 'left', width: 50 },
|
||||
<?php foreach ($list_fields as $field): ?>
|
||||
{
|
||||
label: '<?php echo $field['label'] ?>',
|
||||
prop: '<?php echo $field['camel_name'] ?>',
|
||||
title: '<?php echo $field['label'] ?>',
|
||||
key: '<?php echo $field['camel_name'] ?>',
|
||||
<?php if ($field['is_image']): ?>
|
||||
render(record) {
|
||||
return h(ElAvatar, { size: 48, src: record.row.<?php echo $field['camel_name'] ?> });
|
||||
return h(NAvatar, { size: 48, src: record.<?php echo $field['camel_name'] ?>, round: false });
|
||||
},
|
||||
<?php elseif ($field['choices']): ?>
|
||||
render(record) {
|
||||
@@ -197,8 +197,8 @@ export const columns = [
|
||||
<?php echo $choice['value'] ?>: { text: '<?php echo $choice['label'] ?>', type: '<?php echo $choice['type'] ?>' },
|
||||
<?php endforeach; ?>
|
||||
};
|
||||
const s = map[record.row.<?php echo $field['camel_name'] ?>];
|
||||
return h(ElTag, { type: s?.type || 'info' }, { default: () => s?.text });
|
||||
const s = map[record.<?php echo $field['camel_name'] ?>];
|
||||
return h(NTag, { bordered: false, type: s?.type || 'info' }, { default: () => s?.text });
|
||||
},
|
||||
<?php endif; ?>
|
||||
},
|
||||
@@ -240,8 +240,8 @@ export const columns = [
|
||||
| `index.vue` | 列表页 | 导入 columns.ts、querySchemas.ts |
|
||||
| `edit.vue` | 编辑弹窗 | 被 index.vue 动态加载 |
|
||||
| `detail.vue` | 详情弹窗 | 被 index.vue 动态加载 |
|
||||
| `columns.ts` | 表格列配置 | 被 index.vue 导入,含 ElTag/ElAvatar 渲染 |
|
||||
| `querySchemas.ts` | 查询表单配置 | 被 index.vue 导入,含 Select/Input/DatePicker 组件 |
|
||||
| `columns.ts` | 表格列配置 | 被 index.vue 导入,含 NTag/NAvatar 渲染 |
|
||||
| `querySchemas.ts` | 查询表单配置 | 被 index.vue 导入,含 NSelect/NInput/NDatePicker 组件 |
|
||||
|
||||
## 相关文档
|
||||
|
||||
|
||||
Reference in New Issue
Block a user