提交 a9a9f889 编写于 作者: DCloud-yyl's avatar DCloud-yyl

优化imag图片路径示例,android平台绝对路径通过动态获取appid实现

(cherry picked from commit ffe06a30)
上级 1ad45bff
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<script> <script>
import logo from './logo.png'; import logo from './logo.png';
const appid = uni.getAppBaseInfo().appId;
export default { export default {
data() { data() {
return { return {
...@@ -41,16 +42,15 @@ ...@@ -41,16 +42,15 @@
}, },
{ {
src: '../../../static/Test-Image/Logo.png', src: '../../../static/Test-Image/Logo.png',
description: '本地相对路径忽略大小写(需注意Android打包后无效)' description: '本地相对路径忽略大小写(需注意iOS平台不支持,Android平台云端打包后无效)'
}, },
{ {
src: logo, src: logo,
description: 'import方式' description: 'import方式'
}, },
{ {
src: 'file:///android_asset/apps/__UNI__3584C99/www/static/test-image/logo.png', src: `file:///android_asset/apps/${appid}/www/static/test-image/logo.png`,
// TODO iOS发版时还需再补路径 description: '本地绝对路径file://方式(仅限Android平台,云端打包后生效)'
description: '本地绝对路径file://方式(仅限Android平台,打包后生效,需注意打包后appid匹配)'
}, },
{ {
src: 'testerror.jpg', src: 'testerror.jpg',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册