Getting attributes from video element after page load

  javascript, vue-component, vue.js

I want to get ‘currentSrc’ value from video object.
That’s my code

mounted: function () {
    this.$nextTick(function () {
      console.log(document.getElementById('video').currentSrc)
    });
  },

No matter what I do, I alway get an <empty string>. Which is pretty strange due to a fact that when I do:

mounted: function () {
    this.$nextTick(function () {
      console.log(document.getElementById('video'))
    });
  },

I get in console this object with correct currentSrc attribute.

I tried to use created(), refs, rerendering page by changing element key value, and even timeout, but always I get <empty string> as a result.
When I tried doing @load on video element it just does not work at all.

Is there any way to get object values, right after page is rendered?

Source: Ask Javascript Questions

LEAVE A COMMENT