Merge pull request #1 from element-plus/fix/typescripting-button-component

fix/typescripting-button-component
This commit is contained in:
zazzaz 2020-07-21 22:55:58 +08:00 committed by GitHub
commit e08d5c6279

View File

@ -22,9 +22,19 @@
<span v-if="$slots.default"><slot></slot></span>
</button>
</template>
<script>
<script lang='ts'>
import { computed, inject } from 'vue'
const ELEMENT = {}
const ELEMENT: {
size?: number;
} = {}
// TODOS: replace these interface definition with actual ElForm interface
interface ElForm {
disabled: boolean;
}
interface ElFormItem {
elFormItemSize: number;
}
export default {
name: 'ElButton',
@ -49,16 +59,10 @@ export default {
round: Boolean,
circle: Boolean
},
methods: {
handleClick(evt) {
this.$emit('click', evt);
}
},
setup(props,ctx) {
// inject
const elForm = inject('elForm', '')
const elFormItem = inject('elFormItem', '')
const elForm = inject<ElForm>('elForm')
const elFormItem = inject<ElFormItem>('elFormItem')
// computed
const _elFormItemSize = computed(() => {