243
文章
15
说说
1893
评论
604056
访问

个人博客网站:prettywordpress.com(吃饭用大碗的程序猿)

最新评论 纳尼!怎么还没有人在本站点留言(ó﹏ò。)
A+

解决schema2code生成banner页的uni-file-picker无法显示图片的问题

标签: 最后编辑:2022年1月14日

项目场景:

搭建uni-admin,使用schema2code生成uni-admin后台轮播图展示界面,图片组件未正常显示图片

schema2code生成的代码

<uni-td align="center">
    <template v-for="(file, j) in item.imgs">
        <uni-file-picker v-if="file.fileType == 'image'" :value="file" :file-mediatype="file.fileType" :imageStyles="imageStyles" readonly></uni-file-picker>
        <uni-link v-else :href="file.url" :text="file.url"></uni-link>
    </template>
</uni-td>

我的解决方法:

:value="file"改为v-model="item.imgs[j]",即可正常显示。
如果使用上篇教程的文章改为v-model="file"会抛出
v-model cannot be used on v-for or v-slot scope variables because they are not writable.的错误

造成原因

未知...

知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

发表一下你的评论呗

回复评论代表你同意网站的 隐私政策

... 友情提示 请保留版权标识
复制成功!
目录
今日公告
生命是一团欲望,欲望不能满足便痛苦,满足便无聊,人生就在痛苦和无聊之间摇摆----叔本华
站长技能树
java
60%
javascript
55%
c
10%
typescript
50%
python
10%
免费咨询公众号