ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# uniapp ``` <pre class="calibre29">``` strs<span class="token1">.</span><span class="token3">indexOf</span><span class="token1">(</span><span class="token4">','</span><span class="token1">)</span> <span class="token6">//查找逗号字符出现的位置</span> ``` ``` 计算属性 拼接链接 ``` <pre class="calibre13">``` <span class="token"><</span>view <span class="token2">class</span><span class="token">=</span><span class="token4">"u-flex u-col-top item"</span><span class="token">></span> <span class="token"><</span>view <span class="token2">class</span><span class="token">=</span><span class="token4">"info_label"</span><span class="token">></span>当事人照片<span class="token"><</span><span class="token">/</span>view<span class="token">></span> <span class="token"><</span>view <span class="token2">class</span><span class="token">=</span><span class="token4">"u-flex info_val"</span> v<span class="token">-</span><span class="token2">for</span><span class="token">=</span><span class="token4">"(item,index) in strToarray(personinfos.image)"</span> <span class="token1">:</span>key<span class="token">=</span><span class="token4">"index"</span><span class="token">></span> <span class="token"><</span>image <span class="token2">class</span><span class="token">=</span><span class="token4">"pic"</span> <span class="token1">:</span>src<span class="token">=</span><span class="token4">"imgurl(item)"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>image<span class="token">></span> <span class="token"><</span><span class="token">/</span>view<span class="token">></span> <span class="token"><</span><span class="token">/</span>view<span class="token">></span> computed<span class="token1">:</span><span class="token1">{</span> <span class="token6">//处理图片转换成全部路径</span> <span class="token3">imgurl</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span> <span class="token2">return</span> <span class="token2">function</span><span class="token1">(</span>shorturl<span class="token1">)</span><span class="token1">{</span> console<span class="token1">.</span><span class="token3">log</span><span class="token1">(</span><span class="token4">"准备要拼接的图片url"</span><span class="token1">,</span>shorturl<span class="token1">)</span><span class="token1">;</span> <span class="token2">return</span> rootApi<span class="token">+</span> shorturl <span class="token1">}</span> <span class="token1">}</span><span class="token1">,</span> <span class="token6">//把数组字符串分割成数组</span> <span class="token3">strToarray</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span> <span class="token2">return</span> <span class="token2">function</span><span class="token1">(</span>strs<span class="token1">)</span><span class="token1">{</span> <span class="token2">if</span><span class="token1">(</span>strs<span class="token1">)</span><span class="token1">{</span> <span class="token2">if</span><span class="token1">(</span>strs<span class="token1">.</span><span class="token3">indexOf</span><span class="token1">(</span><span class="token4">','</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span> <span class="token6">//多张图片</span> <span class="token2">return</span> strs<span class="token1">.</span><span class="token3">split</span><span class="token1">(</span><span class="token4">','</span><span class="token1">)</span> <span class="token1">}</span><span class="token2">else</span><span class="token1">{</span> <span class="token6">//一张图片</span> <span class="token2">return</span> <span class="token1">[</span>strs<span class="token1">]</span> <span class="token1">}</span> <span class="token1">}</span><span class="token2">else</span><span class="token1">{</span> <span class="token2">return</span> <span class="token1">[</span><span class="token1">]</span> <span class="token1">}</span> <span class="token1">}</span> <span class="token1">}</span><span class="token1">,</span> <span class="token1">}</span><span class="token1">,</span> ``` ``` ###