Code Monkey home page Code Monkey logo

Comments (4)

JosephusPaye avatar JosephusPaye commented on July 16, 2024

There's another ref in UiTabs for the tab headers. I'm guessing that when your mounted hook is called that ref isn't ready yet.

From the docs, it says:

Note that mounted does not guarantee that all child components have also been mounted. If you want to wait until the entire view has been rendered, you can use vm.$nextTick inside of mounted:

So you can wrap your call to findTabById() in $nextTick():

mounted: function () {
  this.$nextTick(function () {
    // Code that will run only after the
    // entire view has been rendered
  })
}

from keen-ui.

Alona2156 avatar Alona2156 commented on July 16, 2024

Unfortunately that didn't solve the issue, I still have the same error. I understand that all views must be rendered and available inside nextTick, but that's not the case.

from keen-ui.

JosephusPaye avatar JosephusPaye commented on July 16, 2024

Hmmm, don't know why the internal component refs are not available in mounted + nextTick.

Does it work when you run it a little bit after mounting? E.g. with a button that you click to change the active tab. If so then it's definitely a refs rendering issue, and you could use a short (maybe 300ms) timeout in mounted to change the active tab, as a workaround.

Need to figure out what's going wrong with the refs though and fix that.

from keen-ui.

Alona2156 avatar Alona2156 commented on July 16, 2024

Yes, after mounting it works fine, I'm watching a value in Vuex, when it changes I change tab programmatically. That works quite fine. The problem appears only inside mounted hook. If the app is entered not on main route, but on a route that corresponds to a certain tab, I need the tab to change accordingly. Currently I use 1s timeout to avoid getting error, but that's more like a hack than solution. And sometimes I still see an error, so 1s is not always working.

from keen-ui.

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.