taro+vue如何使用本地资源,如:图片
-
如下代码报错:
<template> <image :src="Icon1"></image> <template> <script> import Icon1 from '../../static/home-icon1.png' </script>
错误信息:
vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "Icon1" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property
-
@seaton template 中的变量需要绑定到data里啊
-
@seaton <image class="toutiaoimg" :src="toutiaopng.default"></image>
这样,加一个.default