Subscribe on changes!

After the element is set to width and height, the rendered value is 0

avatar
May 20th 2021

Version

3.0.11

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8cD4gYmFkIDwvcD5cbiAgPHZpZGVvXG4gICAgd2lkdGg9XCIxMDBweFwiXG4gICAgc3JjPVwiaHR0cHM6Ly9tZWRpYS53My5vcmcvMjAxMC8wNS9zaW50ZWwvdHJhaWxlci5tcDRcIlxuICAgIGNvbnRyb2xzXG4gIC8+XG4gIDxpbWdcbiAgICB3aWR0aD1cIjEwMHB4XCJcbiAgICBzcmM9XCJodHRwczovL2ltZy1ibG9nLmNzZG5pbWcuY24vMjAxOTAzMjMxNjE1MzU3NjEucG5nXCJcbiAgLz5cbiAgPHA+IGdvb2QgPC9wPlxuICA8dmlkZW9cbiAgICBzcmM9XCJodHRwczovL21lZGlhLnczLm9yZy8yMDEwLzA1L3NpbnRlbC90cmFpbGVyLm1wNFwiXG4gICAgY29udHJvbHNcbiAgLz5cbiAgPGltZ1xuICAgIHNyYz1cImh0dHBzOi8vaW1nLWJsb2cuY3NkbmltZy5jbi8yMDE5MDMyMzE2MTUzNTc2MS5wbmdcIlxuICAvPlxuPC90ZW1wbGF0ZT5cblxuPHNjcmlwdCBzZXR1cD5cbjwvc2NyaXB0PiJ9

Steps to reproduce

<video
    width="100px"
    src="https://media.w3.org/2010/05/sintel/trailer.mp4"
    controls
  />
<img
    width="100px"
    src="https://img-blog.csdnimg.cn/20190323161535761.png"
  />

What is expected?

width and height can work normally

What is actually happening?

<video
    width="0"
    src="https://media.w3.org/2010/05/sintel/trailer.mp4"
    controls
  />
<img
    width="0"
    src="https://img-blog.csdnimg.cn/20190323161535761.png"
  />
avatar
May 20th 2021

Width must be in pixels, without the unit. This is a native behavior.


Remember to use the forum or the Discord chat to ask questions!