This commit is contained in:
zazzaz 2020-07-21 18:18:44 +08:00
commit 70995def26
14 changed files with 2693 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
node_modules
.DS_Store
dist
*.local

1
README.md Normal file
View File

@ -0,0 +1 @@
Element-Plus

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

2544
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "test",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"vue": "^3.0.0-rc.1"
},
"devDependencies": {
"vite": "^1.0.0-rc.1",
"@vue/compiler-sfc": "^3.0.0-rc.1"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

10
src/App.vue Normal file
View File

@ -0,0 +1,10 @@
<template>
<el-button>Button</el-button>
</template>
<script>
export default {
name: 'App'
}
</script>

4
src/component.js Normal file
View File

@ -0,0 +1,4 @@
import { install } from './components/button/index'
export const installAll = (app) => {
install(app)
}

View File

@ -0,0 +1,5 @@
import { App } from 'vue'
import Button from './src/index.vue'
export const install = function(app: App) {
app.component(Button.name, Button)
}

View File

@ -0,0 +1,88 @@
<template>
<button
class="el-button"
@click="handleClick"
:disabled="buttonDisabled || loading"
:autofocus="autofocus"
:type="nativeType"
:class="[
type ? 'el-button--' + type : '',
buttonSize ? 'el-button--' + buttonSize : '',
{
'is-disabled': buttonDisabled,
'is-loading': loading,
'is-plain': plain,
'is-round': round,
'is-circle': circle
}
]"
>
<i class="el-icon-loading" v-if="loading"></i>
<i :class="icon" v-if="icon && !loading"></i>
<span v-if="$slots.default"><slot></slot></span>
</button>
</template>
<script>
import { computed, inject } from 'vue'
const ELEMENT = {}
export default {
name: 'ElButton',
props: {
type: {
type: String,
default: 'default'
},
size: String,
icon: {
type: String,
default: ''
},
nativeType: {
type: String,
default: 'button'
},
loading: Boolean,
disabled: Boolean,
plain: Boolean,
autofocus: Boolean,
round: Boolean,
circle: Boolean
},
methods: {
handleClick(evt) {
this.$emit('click', evt);
}
},
setup(props,ctx) {
// inject
const elForm = inject('elForm', '')
const elFormItem = inject('elFormItem', '')
// computed
const _elFormItemSize = computed(() => {
return (elFormItem || {}).elFormItemSize
})
const buttonSize = computed(() => {
// todo ELEMENT
return props.size || _elFormItemSize.value || (ELEMENT || {}).size
})
const buttonDisabled = computed(() => {
return props.disabled || (elForm || {}).disabled
})
//methods
const handleClick = (evt) => {
ctx.emit('click', evt)
}
return {
_elFormItemSize,
buttonSize,
buttonDisabled,
handleClick
}
}
};
</script>

8
src/main.js Normal file
View File

@ -0,0 +1,8 @@
import { createApp } from 'vue'
import { installAll } from './component.js'
import './style/element-ui@2.13.2.css'
import App from './App.vue'
const app = createApp(App)
installAll(app)
app.mount('#app')

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.