Skip to content

Commit

Permalink
fix: 🐛 Unable to update path selector
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Nov 2, 2023
1 parent d691780 commit 3279c34
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/components/Preference/PathInput/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<el-input
v-bind="data.props || {}"
:model-value="modelValue"
v-model="pathValue"
clearable
class="!w-full"
:title="$t(data.placeholder)"
:placeholder="$t(data.placeholder)"
@change="handleUpdate"
>
<template #append>
<el-button
Expand All @@ -27,7 +28,7 @@ import { cloneDeep } from 'lodash-es'
export default {
props: {
modelValue: {
type: [String, Array],
type: String,
default: '',
},
data: {
Expand All @@ -36,7 +37,23 @@ export default {
},
},
emits: ['update:model-value'],
data() {
return {
pathValue: '',
}
},
watch: {
modelValue: {
handler(value) {
this.pathValue = value
},
immediate: true,
},
},
methods: {
handleUpdate(value) {
this.$emit('update:model-value', value)
},
async handleSelect(options = {}) {
const { properties, filters } = cloneDeep(options)
try {
Expand All @@ -56,7 +73,7 @@ export default {
const value = files[0]
this.$emit('update:model-value', value)
this.handleUpdate(value)
}
catch (error) {
if (error.message) {
Expand Down

0 comments on commit 3279c34

Please sign in to comment.