mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
update
This commit is contained in:
commit
70995def26
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
*.local
|
13
index.html
Normal file
13
index.html
Normal 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
2544
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
package.json
Normal file
15
package.json
Normal 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
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
10
src/App.vue
Normal file
10
src/App.vue
Normal file
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<el-button>Button</el-button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'App'
|
||||
}
|
||||
</script>
|
4
src/component.js
Normal file
4
src/component.js
Normal file
@ -0,0 +1,4 @@
|
||||
import { install } from './components/button/index'
|
||||
export const installAll = (app) => {
|
||||
install(app)
|
||||
}
|
5
src/components/button/index.ts
Normal file
5
src/components/button/index.ts
Normal 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)
|
||||
}
|
88
src/components/button/src/index.vue
Normal file
88
src/components/button/src/index.vue
Normal 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
8
src/main.js
Normal 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')
|
1
src/style/element-ui@2.13.2.css
Normal file
1
src/style/element-ui@2.13.2.css
Normal file
File diff suppressed because one or more lines are too long
BIN
src/style/fonts/element-icons.ttf
Normal file
BIN
src/style/fonts/element-icons.ttf
Normal file
Binary file not shown.
BIN
src/style/fonts/element-icons.woff
Normal file
BIN
src/style/fonts/element-icons.woff
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user