Giter VIP home page Giter VIP logo

Comments (8)

mazipan avatar mazipan commented on August 22, 2024 1

Anytime.
Don't forget to star this repo ya 😂

from vue2-simplert.

mazipan avatar mazipan commented on August 22, 2024

You can use hook onClose or onConfirm and show second alert

from vue2-simplert.

mazipan avatar mazipan commented on August 22, 2024

You can change this to local variable so they can have wrong refer this, like this example :

 methods: {
    deleteBtn () {
      let self = this
      let confirmFn = function () {
        let obj2 = {
          title: 'Success',
          message: 'Staff record successfully deleted!',
          type: 'success'
        }
        self.$refs.simplert.openSimplert(obj2)
      }
      let obj = {
        title: 'Warning',
        message: 'Are you sure you want to delete staff record?',
        type: 'warning',
        useConfirmBtn: true,
        onConfirm: confirmFn
      }
      self.$refs.simplert.openSimplert(obj)
    }
  }

from vue2-simplert.

maryheng avatar maryheng commented on August 22, 2024

Hi! I've done what you said about using

let self = this

and it works perfectly fine now.

Thank you for your help! 👍

from vue2-simplert.

maryheng avatar maryheng commented on August 22, 2024

Hi again!

I got another problem which i don't quite understand...

I have an error which says, "Cannot read property '$refs' of undefined".
Is this due to the conflicting this.$refs.image.files for the top part of the code?

Here is my Vue Code:

    submitStaff () {
      if (this.$refs.image.files[0]) {
        let formData = new FormData()
        formData.append('userImage', this.$refs.image.files[0])
        formData.append('name', this.data.name)
        formData.append('username', this.data.username)
        formData.append('password', this.data.password)
        axios.post('/testing', formData)
          .then(function (response) {
            let self = this
            let successAlert = {
              title: 'Success',
              message: 'Staff record successfully created!',
              type: 'success'
            }
            self.$refs.simplert.openSimplert(successAlert)
          })
          .catch(function (error) {
            console.log(error)
          })
      }
    }

How do I go about fixing this problem?

Thank you for your help once again! (I starred this repo already 👍 )

from vue2-simplert.

mazipan avatar mazipan commented on August 22, 2024

You can move

let self = this

To the bottom of exactly code

submitStaff () {

I think you need learn about this in Javascript, because this is standard of Javascript.
Not about this library. 😂

from vue2-simplert.

maryheng avatar maryheng commented on August 22, 2024

I feel so silly now! Haha sorry, i'm new to javascript and vue :-) learning and doing a project at the same time. Thanks for your help! 👍

from vue2-simplert.

mazipan avatar mazipan commented on August 22, 2024

No problem 👍

from vue2-simplert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.