简体   繁体   English

离子设备浏览器的区别

[英]Ionic device browser difference

I have my Ionic app all set up, however, it doesn't function like in the browser...for example, the background picture doesn't load. 我已经设置了所有Ionic应用程序,但是,它的功能不像在浏览器中一样。例如,背景图片无法加载。 Does anyone know why? 有人知道为什么吗?

Everything, including the API that app communicates with, is stored locally 一切(包括与应用程序通信的API)都存储在本地

在此处输入图片说明

Here is the view : 这是视图

<ion-view title="Login" id="page2" hide-back-button="true" hide-nav-bar="true">
    <ion-content overflow-scroll="false" padding="true"
                 style="background: url('../img/loginBackground.jpg') no-repeat center;background-size:cover;">
        <form class="list">

            <style scoped>
                .inputCustom{
                    background-color: rgba(255,255,255,0.8);
                }

                .imgBack{
                    display: block;
                    margin-left: auto;
                    margin-right: auto;
                    overflow: visible;
                    min-width: 60vw;
                    max-height: 60vw;
                    max-width: 60vw;
                }
            </style>


            <img src="../img/logo.gif" class="imgBack">

            <div class="spacer" style="height: 60px;"></div>

            <ion-list>
                <label class="item item-input inputCustom">
                    <span class="input-label">E-mail</span>
                    <input type="email" placeholder="" ng-model="user.email">
                </label>
                <label class="item item-input inputCustom">
                    <span class="input-label">Lozinka</span>
                    <input type="password" placeholder="" ng-model="user.password">
                </label>

                <div class="animated flash" ng-show="validationBool"
                     style="text-align: center; padding-top: 5px; color: indianred">{{validationError}}
                </div>

            </ion-list>
            <div class="spacer" style="height: 40px;"></div>
            <a ng-click="signIn()" id="login-button1" class="button button-positive  button-block">Prijavi se</a>
            <a ui-sref="signup" id="login-button2" class="button button-positive  button-block button-clear">Nemaš račun? Registriraj se</a>
        </form>
    </ion-content>
</ion-view>

what I understand here is that you getting problem in showing up images in ionic. 我在这里了解到的是,您在显示离子图像时遇到问题。 So here's the solution. 所以这是解决方案。 Problem in your code is here 您的代码中的问题在这里

background: url('../img/loginBackground.jpg')

You haven't gave a proper url for your image.This must be like this. 您没有为图片提供正确的网址。必须像这样。

background: url('/img/loginBackground.jpg')

Note: No dots and your image would be in "www/img". 注意:没有点,您的图像将在“ www / img”中。
Same for the img tag . img标签相同。

EDIT: 编辑:
try this 尝试这个

.scroll-content {
background:url(/img/loginBackground.jpg) no-repeat center;
background-size: cover;

and remove style bavckground from ionic content. 从离子含量中删除样式bavckground。

I found out that the preceding slash was causing the problem. 我发现前面的斜杠引起了问题。 The correct path is 正确的路径是

<ion-content overflow-scroll="false" padding="true"
                 style="background: url(img/loginBackground.jpg) no-repeat center;background-size:cover;">

And for logo: 对于徽标:

<img src="img/logo.gif" class="imgBack">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM