无法在项目视图中从JSON文件加载图像src链接

时间:2019-02-25 10:56:40

标签: sapui5

我能够将CourseNameText绑定到视图,但是不能将Image链接绑定到视图(在Image src中)

查看代码如下:-

<mvc:View controllerName="Workspace.controller.MasterData" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form">
<Shell>
    <App class="sapUiResponsiveMargin" width="auto">
        <pages>
            <Page title="{i18n>MasterDataTitle}" backgroundDesign="Transparent" showNavButton="true" navButtonPress="onNavBack">
                <l:Grid class="sapUiSmallMarginTop" hSpacing="2" defaultSpan="L6 M6 S10" id="grid1">
                    <l:content>
                        <VBox items="{course>/Courses}">
                            <items>
                                <Image src="{course>Image}" width="100%" press="CreateDataButton">
                                    <layoutData>
                                        <l:GridData span="L3 M3 S8" linebreakL="true" linebreakM="true" linebreakS="true"/>
                                    </layoutData>
                                </Image>
                                <VBox >
                                    <Text text="{course>CourseName}"/>
                                    <Text text="{course>Text}"/>
                                </VBox>
                            </items>
                        </VBox>
                    </l:content>
                </l:Grid>
            </Page>
        </pages>
    </App>
</Shell>

JSON文件如下:-(course.json)

{
"Courses": [{
    "CourseName": "JAVA",
    "Text": "Java is a general-purpose computer-programming language ",
    "Image" :"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI4AAACgCAMAAADthaR8AAAAwFBMVEX"
}, {
    "CourseName": "C++",
    "Text": "Hypertext Preprocessor is a server-side scripting language designed for web development. ",
    "Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI4AAACgCAMAAADthaR8AAAAwFBMVEX"

}, {
    "CourseName": "PHP",
    "Text": "C++ is a general-purpose programming language.  ",
    "Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJoAAABNCAMAAABpGo2yAAAAY1BMVEX///8AAAA/Pz/r6+uFhYX39"

}, {
    "CourseName": "JAVASCRIPT",
    "Text": "SQL is a domain-specific language used in programming and designed .",
    "Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAAeFBMVEX33x4AAAD74x9JQgnUwBrx2h0sKAX/6B/+5R+WiBL/6h"

}, {
    "CourseName": "SQL",
    "Text": "SQL is a domain-specific language used in programming and designed ",
    "Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAADVCAMAAACMuod9AAAA+VBMVEX///8mh84Acsa6ury41DJ/ugAAacO80usUeskkhs4kitC2trgAf8vv7+"

}]

}

0 个答案:

没有答案