pablocattaneo
10/24/2018 - 8:21 PM

How to bind background dinamically in vue

How to bind background dinamically in vue

  <div :style="{ backgroundImage: `url(${bgImg})` }">
    <h1>Content</h1>
  </div>
  
  <script>
    export default {
      data () {
        return {
          bgImg: 'https://via.placeholder.com/1100x1100',
        }
      }
    }
    
  </script>