【发布时间】:2021-06-08 23:26:42
【问题描述】:
大家好,我正在与Nuxt合作
我将图像保存在服务器上作为我想在客户端显示的 blob
我的组件如下所示:
<template>
<div class="product-page">
<div class="product-image">
<img data-image="black" :src="{imgSrc}" alt class="active" />
</div>
<div class="product-info">
<h2>{{ product.name }}</h2>
<h3>{{ product.price }}</h3>
<div class="description">
<p>The purposes of bonsai are primarily contemplation for the viewer, and the pleasant exercise of effort and ingenuity for the grower.</p>
<p>By contrast with other plant cultivation practices, bonsai is not intended for production of food or for medicine. Instead, bonsai practice focuses on long-term cultivation and shaping of one or more small trees growing in a container.</p>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
product: {
type: Object,
default: () => {}
}
},
computed: {
imgSrc() {
const src = URL.createObjectURL(this.product.images.data);
return src;
}
}
};
</script>
但我不断收到以下错误:
URL.createObjectURL 不是函数
有谁知道可能是什么问题?
【问题讨论】:
-
你在什么 mode 使用 nuxt ?错误是否发生在浏览器或服务器上?
-
与信息相关的 GH 问题:github.com/nuxt/nuxt.js/issues/4914