0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

vue.js css background-image を指定

Posted at

vue.js で background-image を指定したい。

hoge.vue

<div v-if="bg" :style="{ 'background-image': 'url(' + bg + ')' }" style="padding-top: 16%;background: no-repeat center center;background-size: cover;"></div>


//略
data () {
    return {
        bg:'',

これで bg の値が変わるたびに 背景も変化する。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?