Skip to content

Commit

Permalink
perf: antdv 支持按钮组
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Nov 7, 2023
1 parent a09c7b0 commit cfdefdf
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/ui/ui-antdv4/src/antdv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export class Antdv implements UiInterface {
});

buttonGroup = creator<ButtonGroupCI>({
name: "a-space",
name: "a-button-group",
builder(opts) {
return buildBinding(this, opts, {});
}
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/ui-antdv4/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { message, notification, Modal } from "ant-design-vue";
import { message, notification, Modal, Button } from "ant-design-vue";
import { uiContext } from "@fast-crud/ui-interface";
import setupIcons from "./icons";
import { Antdv } from "./antdv";
Expand All @@ -24,6 +24,7 @@ export default {
if (options.setupIcons !== false) {
setupIcons(app);
}
app.component("AButtonGroup", Button.Group);
return antdvUi;
},
set
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/ui-demo/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Application from "@/components/Application.vue";
<a-config-provider >
<NConfigProvider>
<Application>
<fs-ui-context>
<RouterView />
</fs-ui-context>
</Application>
</NConfigProvider>
</a-config-provider>
Expand Down
23 changes: 23 additions & 0 deletions packages/ui/ui-demo/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ const radioButtonRender = ()=>{
} }
})
}
const buttonGroupRender = ()=>{
return ui.value.buttonGroup.render({
slots:{default:()=> {
return [
ui.value.button.render({slots:{default:()=>'按钮1'}}),
ui.value.button.render({slots:{default:()=>'按钮2'}})
]
} }
})
}
</script>

<template>
Expand Down Expand Up @@ -138,6 +149,18 @@ const radioButtonRender = ()=>{
<ui-render :render-func="radioButtonRender"></ui-render>
</td>
</tr>
<tr>
<td>buttonGroup</td>
<td>
<component :is="ui.buttonGroup.name">
<component :is="ui.button.name" >按钮1</component>
<component :is="ui.button.name" >按钮2</component>
</component>
</td>
<td>
<ui-render :render-func="buttonGroupRender"></ui-render>
</td>
</tr>

</tbody>
</n-table>
Expand Down

0 comments on commit cfdefdf

Please sign in to comment.