No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    this.$emit not a function in component method

    Framework
    2
    5
    3498
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      liguyu last edited by

      I was trying to call $emit in a method in an vue component file, but got this error. Can anyone out there give me a hand?
      Here is my code:
      methods: {
      bz: function (load) {
      debugger
      this.$emit(‘read’, load)
      }
      }

      1 Reply Last reply Reply Quote 0
      • a47ae
        a47ae last edited by

        It looks like a scoping issue. console.log(this) and lok what it is referring to

        L 1 Reply Last reply Reply Quote 0
        • L
          liguyu @a47ae last edited by

          @a47ae I logged ‘this’, it is a VueComponent, but has no $emit method.
          0_1521989834170_$emit.png

          1 Reply Last reply Reply Quote 0
          • a47ae
            a47ae last edited by

            That’s really strange, it should be available on every VueComponent: https://vuejs.org/v2/api/#vm-emit

            Is it only on this component or also on others?

            L 1 Reply Last reply Reply Quote 0
            • L
              liguyu @a47ae last edited by

              @a47ae Really weird.I use quasar 0.15.12.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post