let arr = [1,2,3,4,5];
if(new Set(arr).size !== arr.length){
alert(存在相同的元素);
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <ul class="drag-menu-container"> <Draggable> <li class="drag-rootMenu" v-for="(item, index) in buttonData" :key="index"> <div class="menu-header"> <span class="header-left"> <Icon type="md-menu" class="menuItem-icon"/> <Input type="text" class="menuItem-title" :value="item.children ? item.group_name: item.button_string" :disabled="readonly" /> <Icon type="ios-arrow-down" class="menuItem-icon" v-show="item.children"/> </span> <span class="header-right"> <Icon type="md-add" class="menuItem-icon" v-show="readonly" /> <Icon type="ios-create-outline" class="menuItem-icon" @click="handleEdit" v-show="readonly"/> <Icon type="ios-trash-outline" class="menuItem-icon" v-show="readonly"/> <Icon type="md-checkmark" class="menuItem-icon" v-show="!readonly" @click="save" /> <Icon type="md-close" class="menuItem-icon" v-show="!readonly"/> </span> </div> <template v-if="item.children && item.children.length > 0"> <ul class="drag-subMenu"> <Draggable> <li v-for="(child, index) in item.children" :key="index"> <div class="menu-header"> <span class="header-left"> <Icon type="md-menu" class="menuItem-icon"/> <span class="menuItem-title">{{child.button_string}}</span> </span> <span class="header-right"> <Icon type="md-add" class="menuItem-icon"/> <Icon type="ios-create-outline" class="menuItem-icon"/> <Icon type="ios-trash-outline" class="menuItem-icon"/> </span> </div> </li> </Draggable> </ul> </template> </li> </Draggable> </ul>
|