uni-app解決無法加載本地圖片的方法【動態加載背景圖片*唯一的解決辦法】
特別注意:千萬別忘記了【`url(${indexBackgroundImage})`】
<template>
<view class="index" :style="{backgroundImage:`url(${indexBackgroundImage})`,backgroundSize: 'cover'}">
<!--你的內容-->
</view>
</template>
<script>
import indexBackgroundImage from "@/static/img/account_index.jpg"
export default {
data() {
return {
indexBackgroundImage:indexBackgroundImage
}
},
methods: {
}
}
</script>
<style lang="scss" scoped="">
</style>
轉自:https://blog.csdn.net/weixin_43343144/article/details/90300788