【发布时间】:2018-01-25 05:07:56
【问题描述】:
我使用 Nuxt.js,并且有一个自定义组件。
该组件在使用css设置背景图片的组件中有css。
我尝试了以下方法,但运行时出现错误。 错误是:
invalid expression: Invalid regular expression flags in
组件
<template>
<section class="bg-img hero is-mobile header-image" v-bind:style="{ backgroundImage: 'url(' + image + ')' }">
<div class="">
<div class="hero-body">
<div class="container">
<h1 class="title">
{{ result }}
</h1>
<h2 class="subtitle ">
Hero subtitle
</h2>
</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: ['result', 'image']
}
</script>
<style>
.bg-img {
background-image: url(~/assets/autumn-tree.jpg);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #999;
}
</style>
【问题讨论】:
标签: javascript css vuejs2 nuxt.js