javascript - vue uses v-for to implement the drop-down box of Are You Hungry?
迷茫
迷茫 2017-05-19 10:35:51
0
2
588
<el-dropdown @command="handleCommand">
                    <el-button type="primary">
                        {{dropvalue}}<i class="el-icon-caret-bottom el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item v-for="(item,index) in dropDowns" command="item.index">{{item.name}}</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>

If you want to get the index in the current loop, "1, 2, 3···" instead of the "item.index" string, the incoming command="item.index" will not work. The display effect is as follows

The command command here is the default if you are hungry. If you use an enumeration drop-down box, such as:
<el-dropdown-item command="a">Golden Cake</el-dropdown- item>At this time, the value can be obtained as a.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
習慣沉默
:command="item.index"
淡淡烟草味

The above is correct haha

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template