Javascript 图像不’;用于ionic应用程序的t显示设备
我使用离子3 图像文件是\src\assets\img 基本页Javascript 图像不’;用于ionic应用程序的t显示设备,javascript,html,angular,ionic2,ionic3,Javascript,Html,Angular,Ionic2,Ionic3,我使用离子3 图像文件是\src\assets\img 基本页 export class BasicPage { items = []; constructor(public nav: NavController ,private admob: AdMob) { this.items = [ { 'title': ' Managing Coins & Gems ', 'icon': 'assets/img/icone2.png', 'descripti
export class BasicPage {
items = [];
constructor(public nav: NavController ,private admob: AdMob) {
this.items = [
{
'title': ' Managing Coins & Gems ',
'icon': 'assets/img/icone2.png',
'description': ' a way to farm gems ifem pack.<br><br> <img src="assets/img/pic3.jpg"> <br><br> Shadow Fight ments are about 15 seconds long for 1 Gem. <br><br> <img src="./assets/img/pic4.jpg"> <br><br> There’s also a rewards by completing in game achievements. This usually gives a player about 1 Gem per achievement, but as you go through the game, the rewards ramp up proportionally. You havecon).<br><br> <img src="assets/img/pic5.jpg"> <br><br>',
'color': '#FFD439'
},
{
'title': ' Gear Sets, Skill Trees & Moves ',
'icon': 'assets/img/icone3.png',
'description': ' Unless <br> Skill trees in the bump. <br><br> <img src="assets/img/pic7.jpg"> <br><br>Make ',
'color': '#CE6296'
},
]
}
在html页面Nagiviation中
暗影战斗2指南
{{item.title}
当您执行ionic run--device
时,将使用资产和构建文件夹创建一个新文件夹www
,并将所有.ts
文件编译为javascript并存储在名为main.js
的单个文件中。您应该添加/
(点)以告知webview图像位于相邻文件夹中:
'icon': './assets/img/icone2.png',
您的图像URL来自一个组件,现在您可以使用属性绑定,当我们使用img src时,有时它在实际设备上不起作用-
<img src="{{item.icon}}">
然后它在浏览器中工作,但在实际设备中有时不工作,因此这里是另一种使用属性绑定的方法-
<img [src]="item.icon">
这是在真正的设备上工作。是的,我尝试了。/assets;//资产/通过访问chrome://devices/
你可以看到它抛出的404错误,请将错误粘贴到这里好吗?很抱歉,我构建apk时没有错误,只是安装了它,但图像没有显示。我一直在到处寻找答案。事实证明,图像位置需要1个句号,才能在应用程序和模拟器上显示图像。非常感谢!说真的,“句号”-对“.”的另一个术语,今天学到了两个新东西!
<img [src]="item.icon">