mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
feat: add global components registry
This commit is contained in:
parent
2739b514da
commit
00d0608d52
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
*.local
|
||||
lerna-debug.json
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { addDecorator } from '@storybook/html';
|
||||
import { createApp } from 'vue';
|
||||
import '../src/style/element-ui@2.13.2.css';
|
||||
import install from '../packages/element-plus'
|
||||
|
||||
/**
|
||||
* Wraps a story into a Vue Element
|
||||
* @param {JSX.Element} template - Story templates
|
||||
@ -27,13 +29,7 @@ function CustomDecorator(content, context) {
|
||||
const app = typeof templateOrComponent === 'string'
|
||||
? createApp(Wrapper(templateOrComponent))
|
||||
: createApp(templateOrComponent)
|
||||
|
||||
const installers = context?.parameters?.component
|
||||
if (Array.isArray(installers)) {
|
||||
installers.forEach(installer => installer(app))
|
||||
} else {
|
||||
installers?.(app)
|
||||
}
|
||||
install(app)
|
||||
const entry = document.createElement('div');
|
||||
entry.className = 'element-plus-previewer';
|
||||
app.mount(entry);
|
||||
|
@ -1,10 +1,7 @@
|
||||
import Basic from './basic.vue'
|
||||
import ElBadge from '../index'
|
||||
import ElButton from '@element-plus/button'
|
||||
|
||||
export default {
|
||||
title: "Badge",
|
||||
component: [ElButton, ElBadge]
|
||||
}
|
||||
|
||||
export const BasicUsage = () => Basic
|
||||
|
@ -1,8 +1,5 @@
|
||||
import ElButton from '../index';
|
||||
|
||||
export default {
|
||||
title: 'Button',
|
||||
component: ElButton,
|
||||
};
|
||||
|
||||
export const NormalButton = () => '<el-button>With Text</el-button>'
|
||||
|
11
packages/element-plus/README.md
Normal file
11
packages/element-plus/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# `element-plus`
|
||||
|
||||
> TODO: description
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
const elementPlus = require('element-plus');
|
||||
|
||||
// TODO: DEMONSTRATE API
|
||||
```
|
12
packages/element-plus/index.ts
Normal file
12
packages/element-plus/index.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { App } from 'vue'
|
||||
import ElButton from '@element-plus/button'
|
||||
import ElBadge from '@element-plus/badge'
|
||||
|
||||
export {
|
||||
ElButton, ElBadge,
|
||||
}
|
||||
|
||||
export default function install(app: App) {
|
||||
ElButton(app)
|
||||
ElBadge(app)
|
||||
}
|
20
packages/element-plus/package.json
Normal file
20
packages/element-plus/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "element-plus",
|
||||
"version": "0.0.1",
|
||||
"description": "> TODO: description",
|
||||
"author": "Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>",
|
||||
"homepage": "https://github.com/element-plus/element-plus#readme",
|
||||
"license": "ISC",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/element-plus/element-plus.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/element-plus/element-plus/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/badge": "^0.0.0",
|
||||
"@element-plus/button": "^0.0.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user