Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
State changed before displaying swal message in vuejs
<b-card-text class="mb-0">
    Success
</b-card-text>
<b-form-checkbox
   checked="true"
   class="custom-control-success"
   name="check-button"
   switch
   @change="changeStatus"
/>

    changeStatus() {
      this.$swal({
        icon: "question",
        text: "Change Status?",
        buttonsStyling: false,
        showCancelButton: true,
        confirmButtonText: "OK",
      }).then((result) => {
        if (result.isConfirmed) {
          // handle code
        }
      });
    },

I am making checkbox in vuejs. When I click on the status to switch the status, it shows a swal saying Change Status. The problem I have is: When I just press status, a message swal appears, the status has been changed. I want if I press Ok the status will change, but if I press cancel it will stay the same, Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

your switch is not reactive value
checked default is true right, when its change it will be false

you just need make it reactive

example:
data():{ arr:[{name: "test", status: true}, {name: "test2", status: false}]}

make it reactive

<table id="example-1">
  <tr v-for="item in arr" :key="item.name">
    <td>{{ item.name }}</td>
    <td>
    <b-form-checkbox
       checked="item.status" <--- this make it reactive
       class="custom-control-success"
       name="check-button"
       switch
       @change="changeStatus"
    />
  </td>
  </tr>
</table>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!