Browse Source

fix changepwd dialog

ljw 1 year ago
parent
commit
d8c129e465
1 changed files with 10 additions and 4 deletions
  1. 10 4
      src/components/changePwdDialog.vue

+ 10 - 4
src/components/changePwdDialog.vue

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <el-dialog v-model="visible" width="50%" :show-close="false">
2
+  <el-dialog v-model="v" width="50%" :show-close="false">
3 3
     <el-form ref="cpwd" :model="changePwdForm" :rules="chagePwdRules" label-width="150px" label-position="left" style="margin-top: 20px">
4 4
       <el-form-item :label="T('OldPassword')" prop="old_password">
5 5
         <el-input v-model="changePwdForm.old_password" :placeholder="T('For OIDC login without a password, enter any 4-20 letters')" show-password></el-input>
@@ -20,15 +20,21 @@
20 20
 
21 21
 <script setup>
22 22
 
23
-  import { reactive, ref } from 'vue'
23
+  import { computed, reactive, ref } from 'vue'
24 24
   import { ElMessageBox } from 'element-plus'
25 25
   import { changeCurPwd } from '@/api/user'
26 26
   import { useUserStore } from '@/store/user'
27 27
   import { T } from '@/utils/i18n'
28
+
28 29
   const props = defineProps({
29 30
     visible: Boolean,
30 31
   })
31
-
32
+  const v = computed({
33
+    get: () => props.visible,
34
+    set: (val) => {
35
+      emit('update:visible', val)
36
+    },
37
+  })
32 38
   const emit = defineEmits(['update:visible'])
33 39
 
34 40
   // Watch for changes to the prop and emit an event if necessary
@@ -112,4 +118,4 @@
112 118
 
113 119
 <style scoped lang="scss">
114 120
 
115
-</style>
121
+</style>