Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Input/SInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/>
<template v-if="type === InputType.TEXT_FILE">
<i class="s-icon-file"></i>
<input type="file" :accept="accept" @change="handleTextFileChange">
<input :value="emptyValue" type="file" :accept="accept" @change="handleTextFileChange">
</template>
</div>
</template>
Expand All @@ -45,6 +45,7 @@ import { Autocomplete, InputType } from './consts'
@Component
export default class SInput extends Vue {
readonly InputType = InputType
readonly emptyValue = null
/**
* Type of input. It can be "text" or "textarea" or any native input type.
* `"text"` by default
Expand Down Expand Up @@ -129,6 +130,7 @@ export default class SInput extends Vue {

@Watch('model')
private handleValueChange (value: string | number): void {
this.$emit('input', value)
this.$emit('change', value)
}

Expand Down
21 changes: 14 additions & 7 deletions src/stories/SInput.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,21 @@ export const withTextLimit = () => ({

export const textFileInput = () => ({
components: { SInput },
template: `<s-input
v-model="input"
type="text-file"
placeholder="Upload or input text"
:accept="accept"
/>`,
template: `<div class="flex" style="flex: 1; flex-direction: column;">
<s-input
v-model="vModelValue"
type="text-file"
placeholder="Upload or input text"
:accept="accept"
@change="(value) => changeValue = value"
/>
<span style="margin-top: 40px;">
v-model="{{ vModelValue }}", @change="{{ changeValue }}"
</span>
</div>`,
data: () => ({
input: ''
vModelValue: '',
changeValue: ''
}),
props: {
accept: {
Expand Down