vue项目如何利用v-for批量绑定按钮,下面给大家简单介绍一下实现代码!
1、定义一个v-for循环
<el-button v-for="(item, index) in tableBtn" :type="item.type" :icon="item.icon" :key="index" @click="callBack(item.method)"> { item.label }} </el-button>
2、tableBtn数组
_table.tableBtn = [
{
type: "primary",
icon: "el-icon-picture-outline",
method: "openImage",
label: "图像"
},
{
type: "primary",
icon: "el-icon-document",
method: "openReport",
label: "报告"
},
{
type: "danger",
icon: "el-icon-video-camera",
method: "openVideo",
label: "视频"
}
];
3、methods按钮事件
openImage() {
console.log("打开图像");
},
openReport() {
console.log("打开报告";
},
openVideo() {
console.log("打开视频");
},
callBack(method) {
this[method]();
}
v-for循环绑定el-color-picker颜色选择器绑定value/v-model值
上面是“vue项目利用v-for批量绑定按钮”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2941.html
workflows工作流
小鸟在黑暗的天空中优雅地跳舞
树上挂着一只表情可爱的香蕉ComfyUI工作流二
一种长着彩虹翅膀的虫子comfyui工作流
五颜六色的球花comfyui工作流
葡萄庄园白葡萄酒ComfyUI工作流
一群邪恶的小黄人ComfyUI工作流
金属埃及人ComfyUI工作流
一个外国人在吹奏萨克斯ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

如何利用css3+js做一个下雨效果
做一个好玩的时钟翻牌效果
3D立体人物效果
用canvas实现画板涂鸦效果
js实现下雪特效
一个包含老黄历、佛历、道历、星宿等数据的日历网站
3d文字360度旋转
纯css3绘制的小鸟







