flex 一个比较棘手的问题<关于Button icon属性>

一个变量: private var imageUrl:String = "@Embed(source='../../../images/desk/"; //ky.png')


一个迭代器:<mx:Repeater id="de2" dataProvider="{commonDesks}">
<mx:Button label="{de2.currentItem.toString()}" height="102" width="121" buttonMode="true" icon="问题在这里" labelPlacement="bottom" cornerRadius="20" borderColor="#77F37D" themeColor="#0EFBD1" fillAlphas="[0.28, 0.06, 1.0, 0.06]" alpha="1.0"/>
</mx:Repeater>


注释:这是从服务器返回的一个xml格式的数据。commonDesks 为一个ArrayCollection.
这个迭代器<de2>循环输出的是一个按钮!

Button 中icon需要的是一个class类型。

资料:1. private var imageUrl:Class= "@Embed(source='../../../images/desk/ky.png')" as Class; 这样,在icon属性中可以这样写:icon="{imageUrl}" ,这样是对的!

2.private var imageUrl:String= "@Embed(source='../../../images/desk/ky.png')"; 这样,在icon属性中可以这样写:icon="{imageUrl as Class}" ,这样也是对的!


问题: 如果在最起初(页首)的字符串<imageUrl>中,在icon中要对字符串<ky.png')>进行拼接,要怎么写<这里主要适应(ky.png)可以变换>?

可能表述的不是很清楚。

icon={("{imageUrl}"+"ky.png") as Class}; 这是错误的,但是能够表达出题意,也就是第一要:ky.png图片是可变的,二又要确保icon中是一个Class类型!

苦思幂想了好久,都弄不出来!故发帖到javaEye上!希望大家各抒己见!谢谢大家!


简要说明:

在Button 中的icon属性,就是设置按钮的图片嘛,如何对icon中的值进行组合!必有一个已知的字符串然后再加上一个已知的字符串。
var str1:String = "@Embed(source='../../../images/desk/";
var str2:String = "ky.png')";
如果在Button中的icon属性中队这两个字符进行拼接。 请问这么写? 谢谢!
``` <template> <lay-layout class="home-class"> <lay-header> <lay-logo class="logo">工单管理系统</lay-logo> <lay-switch v-model="collapse"></lay-switch> <lay-switch v-model="active20"></lay-switch> <lay-dropdown> <lay-button type="text" icon="layui-icon-user"></lay-button> <template #content> <lay-dropdown-menu> <lay-dropdown-menu-item>个人中心</lay-dropdown-menu-item> <lay-dropdown-menu-item divided>退出登录</lay-dropdown-menu-item> </lay-dropdown-menu> </template> </lay-dropdown> </lay-header> <lay-layout class="flex-container"> <!-- 侧边菜单 --> <lay-side> <lay-menu :collapse="collapse" :tree="isTree" :theme="active20 ? 'dark' : 'light'" :selected-key="selectedKey" :open-keys="openKey" @changeSelectedKey="changeSelectedKey"> <lay-menu-item id="/"> <template #icon> <lay-icon type="layui-icon-home"></lay-icon> </template> <template #title> 首页 </template> </lay-menu-item> <lay-sub-menu id="/processUsage"> <template #icon> <lay-icon type="layui-icon-template"></lay-icon> </template> <template #title> 流程使用 </template> <lay-menu-item id="/apply">工单申请</lay-menu-item> <lay-menu-item id="/draft">草稿箱</lay-menu-item> <lay-menu-item id="/todo">待办事项</lay-menu-item> </lay-sub-menu> <lay-sub-menu title="流程查询" is="queryProcess"> <template #icon> <lay-icon type="layui-icon-search"></lay-icon> </template> <template #title> 流程查询 </template> <lay-menu-item id="/query">工单查询</lay-menu-item> <lay-menu-item id="/my-process">我的发起</lay-menu-item> <lay-menu-item id="/processed">已处理工单</lay-menu-item> </lay-sub-menu> <lay-sub-menu title="系统管理" v-if="isAdmin" id="/system"> <template #icon> <lay-icon type="layui-icon-set"></lay-icon> </template> <template #title> 系统管理 </template> <lay-menu-item id="/permission">权限管理</lay-menu-item> <lay-menu-item id="/workflow">流程配置</lay-menu-item> </lay-sub-menu> </lay-menu> </lay-side> <!-- 主体内容 --> <lay-body style="padding: 20px"> <!-- 面包屑 --> <GlobalBreadcrumb></GlobalBreadcrumb> <router-view /> </lay-body> </lay-layout> </lay-layout> </template> <script setup> import { ref } from 'vue'; import GlobalBreadcrumb from '../components/global/GlobalBreadcrumb.vue'; const isAdmin = ref(true); const collapse = ref(false); const active20 = ref(false); const selectedKey = ref("/") const openKey = ref(["/"]) const isTree = ref(true) </script>```lay-header 怎么设置logo在左边
03-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值