Get element style in vue

  1. vue uses this.$refs.name.style to get introverted styles, not css styles
  2. I would like to ask you how to get the style written in css? For example, background-color.
  3. trouble to write the code, not just which attribute to use, it"s too vague.
Mar.25,2021

clipboard.png


pseudo demand.

vue is data-driven, which means you should be able to get the information you want from the data element style .


if your requirement is to add or replace styles, bind class


change your way of thinking earlier. Instead of getting elements to change styles like jquery, vue treats styles as an object, or uses a variable to control styles

Menu