-
Notifications
You must be signed in to change notification settings - Fork 0
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
8 changed files
with
251 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts" setup> | ||
import type { ButtonGroupProps, } from './types'; | ||
import { provide, toRef, reactive } from 'vue'; | ||
import { BUTTON_GROUP_CTX_KEY } from './contants'; | ||
defineOptions({ | ||
name: 'MyButtonGroup', | ||
}) | ||
const props = defineProps<ButtonGroupProps>() | ||
provide(BUTTON_GROUP_CTX_KEY, reactive({ | ||
disabled: toRef(props, 'disabled'), | ||
size: toRef(props, 'size'), | ||
type: toRef(props, 'type'), | ||
})) | ||
</script> | ||
<template> | ||
<div class="my-button-group"> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
<style scoped> | ||
@import './style.css'; | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { InjectionKey } from "vue"; | ||
import type { ButtonGroupContext } from "./types"; | ||
|
||
export const BUTTON_GROUP_CTX_KEY: InjectionKey<ButtonGroupContext> = | ||
Symbol("BUTTON_GROUP_CTX_KEY"); | ||
|
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,6 +1,8 @@ | ||
import Button from './Button.vue' | ||
import ButtonGroup from './ButtonGroup.vue' | ||
import { withInstall } from '@moyu-ui/utils' | ||
|
||
export const MyButton = withInstall(Button) | ||
export const MyButtonGroup = withInstall(ButtonGroup) | ||
|
||
export * from './types' |
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,4 +1,4 @@ | ||
import { MyButton, MyIcon } from "@moyu-ui/components"; | ||
import { MyButton, MyIcon, MyButtonGroup } from "@moyu-ui/components"; | ||
import type { Plugin } from "vue"; | ||
|
||
export default [MyButton, MyIcon ] as Plugin[]; | ||
export default [MyButton, MyIcon, MyButtonGroup ] as Plugin[]; |
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