[英]How to make vuetify v-stepper header as completed in dynamically?
Currently, I am working on <v-stepper>
on vuetify js, and there are 12 steps that I've created.目前,我正在 vuetify js 上开发
<v-stepper>
,我已经创建了 12 个步骤。 Every step there are set of tasks of contents available when you will click on each step, and accordingly step the contents will be changed by on click.每一步都有一组可用的内容任务,当您单击每个步骤时,相应的步骤内容将通过单击进行更改。 I wanted the
<v-stepper>
step will show complete(or tick icon) if the set of tasks has completed on that particular step.我希望
<v-stepper>
步骤将显示完成(或勾选图标),如果该组任务已在该特定步骤上完成。 Let's say if Step 1
is completed then step 1
icon should show a green tick icon.假设
Step 1
已完成,则step 1
图标应显示绿色勾号图标。 Now contents are populated on each step and I have the completed steps data but couldn't able to show complete-icon
if the step is completed.现在每个步骤都填充了内容,我有完成的步骤数据,但如果步骤完成,则无法显示
complete-icon
。
Below is my code:下面是我的代码:
<v-stepper-header>
<template v-for="n in steps">
<v-stepper-step :key="`${n}-step`" complete="completed" :step="n" :editable="editable" >
Week {{ n }}
</v-stepper-step>
<v-divider v-if="n !== steps" :key="n"></v-divider>
</template>
</v-stepper-header>
completed method:完成方法:
e1(e1){
this.SET_STATUS_TO_DEFAULT(false)
// alert here
console.log(e1)
if(this.completedWeeksList.includes(e1)){
this.completed = true
this.editable = false
}else{
this.completed = false
this.editable = true
}
}
Please let me know if you need more elaboration.如果您需要更多详细说明,请告诉我。
The question isn't clear on wether you're trying to change the complete icon, or just trying to change the color to show the step as completed.问题不清楚您是尝试更改完整图标,还是只是尝试更改颜色以显示步骤已完成。
Either way complete is a prop, so you must pass it in as :complete
...无论哪种方式完成都是一个道具,所以你必须将它作为
:complete
...
<v-stepper-header>
<template v-for="n in steps">
<v-stepper-step :key="`${n}-step`" :complete="completed" :step="n" :editable="editable" >
Week {{ n }}
</v-stepper-step>
<v-divider v-if="n !== steps" :key="n"></v-divider>
</template>
</v-stepper-header>
Demo: https://codeply.com/p/kNjSEzu15W演示: https : //codeply.com/p/kNjSEzu15W
the problem with the <v-stepper>
in vutify is that, the <v-divider>
must be a sibling not a child of each individual step, so in this case you need to use the <template>
element to loop through the list of items by printing 2 siblings or more for each iteration and the most important thing to note here is all children of <template>
which are siblings must have the same :key
binding attribute but not the same value when you use it for any v-for
directive vutify 中
<v-stepper>
的问题在于, <v-divider>
必须是兄弟,而不是每个单独步骤的子级,因此在这种情况下,您需要使用<template>
元素来遍历列表通过为每次迭代打印2 个或更多兄弟姐妹来确定项目,这里要注意的最重要的事情是<template>
所有孩子,这些兄弟姐妹必须具有相同的:key
绑定属性,但当您将其用于任何v-for
时,不能具有相同的值v-for
指令
<v-stepper v-if="studyReportsList.length > 1">
<v-stepper-header>
<template v-for="(item, key) in studyReportsList">
<!-- all siblings must have the same :key or v-bind:key-->
<v-stepper-step :key="key+1" :step="key+1" editable>
{{ item.name }}
</v-stepper-step>
<v-divider v-if="key !== studyReportsList.length - 1" :key="key"></v-divider>
</template>
</v-stepper-header>
</v-stepper>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.