| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <template>
- <div>
- <ul class="sidebar">
- <li v-if="list.length<=0">暂无数据</li>
- <li @click="handleItem(item)" :class="{active:item.id==activeId}" v-for="(item,i) in list" :key="i">{{item.name}}</li>
- </ul>
- <slot name="bottom"></slot>
- </div>
- </template>
- <script>
- export default {
- props:{
- list:{
- type:Array,
- default:()=>{
- return []
- }
- },
- activeId:{
- type:String,
- default:''
- }
- },
- methods:{
- handleItem(item){
- this.$emit('handleItem',item)
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .sidebar{
- border: .04rem solid #9E9E9E;
- max-width: 18.42rem;
- min-width: 10rem;
- li{
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
- line-height: 2.08rem;
- height: 2.08rem;
- padding: 0 .42rem 0 1rem;
- position: relative;
- font-size: 1rem;
- cursor: pointer;
- color: #fff;
- background-color: #9e9e9e;
- text-align: left;
-
- &:hover{
- background-color: @theme;
- color: #F5B55F;
- }
- }
- .active{
- font-weight: bold;
- color: #F5B55F;
- background-color: @theme;
- }
- }
- </style>
|