1

所以我在 html 中创建了一个图像,并试图给它属性 v-bind:src。

这是代码行:

<img class="summonericon" ref="summonerIcon" v-bind:src="summonerRequests.profileIcon">

SummonerRequests.profileIcon 是我使用冷融合函数保存的变量:

<cffunction name="getSummonerByName" access="remote" returntype="string" returnformat="JSON">
    <cfargument name="summonerName" required="true" type="string">
    <cfargument name="region" required="true" type="string">

    <cfset requesturl = "https://" & lCase(region) & "1.api.riotgames.com/lol/summoner/v4/summoners/by-name/" & summonerName & "?api_key=" & api_key>

    <cfhttp 
        method="get"
        url="#requesturl#" result="SummonerDTOJson">
        <cfhttpparam name="content-type" value="application/json" type="header">
        <cfhttpparam name="accept" value="application/json" type="header">
    </cfhttp>

    <cfset summonerDTO=deserializeJSON(SummonerDTOJson.filecontent)>
    <cfset client.profileIcon
    ="https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/profile-icons/" & summonerDTO.profileIconId & ".jpg">
    <cfreturn serializeJSON(summonerDTO)>
</cffunction>

虽然图片 url 存在,但我无法设置图片的来源。我真的需要帮助,谢谢你的帮助。

4

0 回答 0