ソースを参照

Add resetSpecificStep function and update tab watch logic in QrCode component

0es 4 ヶ月 前
コミット
2f5a8620ef
2 ファイル変更9 行追加0 行削除
  1. 4 0
      app/components/popup/QrCode.vue
  2. 5 0
      app/composables/useQrCodePopup.ts

+ 4 - 0
app/components/popup/QrCode.vue

@@ -21,6 +21,7 @@ const {
   updateQrcodeValue,
   updateCurrencyAmount,
   updateSkillInfo,
+  resetSpecificStep,
 } = useQrCodePopup()
 const { open: openSelectListPopup, state: selectListState } = useSelectListPopup()
 const { playmateInfo, userProfile } = useAuth()
@@ -131,6 +132,9 @@ watch(() => [state.visible, state.activeTab, state.skillId], ([visible, tab, ski
   if (tab === 'general' && skillId) {
     generateQrCode(1)
   }
+  else if (tab === 'specific' && skillId) {
+    resetSpecificStep()
+  }
 })
 
 watch(() => state.specificStep, (step) => {

+ 5 - 0
app/composables/useQrCodePopup.ts

@@ -79,6 +79,10 @@ const switchTab = (tab: 'general' | 'specific') => {
   }
 }
 
+const resetSpecificStep = () => {
+  state.specificStep = 'form'
+}
+
 const setSpecificQty = (value: number) => {
   const next = value || 1
   state.specificQty = next < 1 ? 1 : next
@@ -126,5 +130,6 @@ export const useQrCodePopup = () => {
     updateQrcodeValue,
     updateCurrencyAmount,
     updateSkillInfo,
+    resetSpecificStep,
   }
 }