mirror of
				https://github.com/antd-tiny-vue/antd-tiny-vue.git
				synced 2025-11-04 18:41:45 +08:00 
			
		
		
		
	feat: add button
This commit is contained in:
		
							
								
								
									
										9
									
								
								components/button/button.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								components/button/button.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					import { defineComponent } from 'vue'
 | 
				
			||||||
 | 
					export default defineComponent({
 | 
				
			||||||
 | 
					  name: 'AButton',
 | 
				
			||||||
 | 
					  setup(props, { slots }) {
 | 
				
			||||||
 | 
					    return () => {
 | 
				
			||||||
 | 
					      return <button>{slots.default?.()}</button>
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
							
								
								
									
										8
									
								
								components/button/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								components/button/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					import type { App } from 'vue'
 | 
				
			||||||
 | 
					import Button from './button'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Button.install = function (app: App) {
 | 
				
			||||||
 | 
					  app.component(Button.name, Button)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default Button
 | 
				
			||||||
							
								
								
									
										1
									
								
								components/components.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								components/components.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					export { default as Button } from './button'
 | 
				
			||||||
@@ -1,7 +1,15 @@
 | 
				
			|||||||
export {}
 | 
					import type { App, Plugin } from 'vue'
 | 
				
			||||||
 | 
					import * as components from './components'
 | 
				
			||||||
 | 
					import version from './version'
 | 
				
			||||||
 | 
					export * from './components'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const aaa = () => {
 | 
					export default {
 | 
				
			||||||
  // TODO
 | 
					  install(app: App) {
 | 
				
			||||||
 | 
					    Object.values(components).forEach(component => {
 | 
				
			||||||
 | 
					      if (component.install) {
 | 
				
			||||||
 | 
					        app.use(component as any)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
export default aaa
 | 
					  },
 | 
				
			||||||
 | 
					  version
 | 
				
			||||||
 | 
					} as Plugin
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user