refactor:dropdown menu

This commit is contained in:
Pan 2017-11-21 10:37:33 +08:00
parent 3f9df15c30
commit 43a51148fe
1 changed files with 3 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="share-dropdown-menu" @click.native="click" :class="{active:isActive}"> <div class="share-dropdown-menu" :class="{active:isActive}">
<div class="share-dropdown-menu-wrapper"> <div class="share-dropdown-menu-wrapper">
<span class="share-dropdown-menu-title">{{title}}</span> <span class="share-dropdown-menu-title" @click.self="clickTitle">{{title}}</span>
<div class="share-dropdown-menu-item" v-for="(item,index) of items" :key='index'> <div class="share-dropdown-menu-item" v-for="(item,index) of items" :key='index'>
<a v-if="item.href" :href="item.href" target="_blank">{{item.title}}</a> <a v-if="item.href" :href="item.href" target="_blank">{{item.title}}</a>
<span v-else>{{item.title}}</span> <span v-else>{{item.title}}</span>
@ -27,7 +27,7 @@ export default {
} }
}, },
methods: { methods: {
click() { clickTitle() {
this.isActive = !this.isActive this.isActive = !this.isActive
} }
} }
@ -43,7 +43,6 @@ $t: .1s;
&-title { &-title {
width: 100%; width: 100%;
display: block; display: block;
vertical-align: middle;
cursor: pointer; cursor: pointer;
background: black; background: black;
color: white; color: white;