Skip to content

Commit

Permalink
feat(refs): expose input/table/upload/select refs
Browse files Browse the repository at this point in the history
  • Loading branch information
0721Betty authored and ysfscream committed Jan 21, 2022
1 parent 68db28a commit b2491b6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
10 changes: 8 additions & 2 deletions packages/Input/src/input.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-input class="emqx-input">
<el-input ref="input" class="emqx-input">
<template v-if="$slots.prepend" #prepend>
<slot name="prepend"></slot>
</template>
Expand All @@ -16,13 +16,19 @@
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { defineComponent, ref } from 'vue'
import { ElInput } from 'element-plus'
export default defineComponent({
name: 'EmqxInput',
components: {
ElInput,
},
setup() {
const input = ref()
return {
input,
}
},
})
</script>
10 changes: 8 additions & 2 deletions packages/Select/src/select.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<template>
<el-select class="emqx-select" ref="select">
<el-select ref="select" class="emqx-select">
<slot></slot>
</el-select>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { defineComponent, ref } from 'vue'
import { ElSelect } from 'element-plus'
export default defineComponent({
name: 'EmqxSelect',
components: {
ElSelect,
},
setup() {
const select = ref()
return {
select,
}
},
})
</script>
10 changes: 8 additions & 2 deletions packages/Table/src/table.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<template>
<el-table class="emqx-table">
<el-table ref="table" class="emqx-table">
<slot></slot>
</el-table>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { defineComponent, ref } from 'vue'
import { ElTable } from 'element-plus'
export default defineComponent({
name: 'EmqxTable',
components: {
ElTable,
},
setup() {
const table = ref()
return {
table,
}
},
})
</script>
10 changes: 8 additions & 2 deletions packages/Upload/src/upload.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-upload class="emqx-upload">
<el-upload ref="upload" class="emqx-upload">
<slot></slot>
<template v-if="$slots.tip" #tip>
<slot name="tip"></slot>
Expand All @@ -8,13 +8,19 @@
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { defineComponent, ref } from 'vue'
import { ElUpload } from 'element-plus'
export default defineComponent({
name: 'EmqxUpload',
components: {
ElUpload,
},
setup() {
const upload = ref()
return {
upload,
}
},
})
</script>

0 comments on commit b2491b6

Please sign in to comment.