Coder Social home page Coder Social logo

davidnotplay / vue-my-dropdown Goto Github PK

View Code? Open in Web Editor NEW
31.0 1.0 9.0 2.33 MB

Dropdown box component to vuejs

Home Page: https://davidnotplay.github.io/vue-my-dropdown/

License: MIT License

JavaScript 75.63% Vue 23.73% HTML 0.64%
component javascript dropdown vuejs

vue-my-dropdown's Introduction

Vue my dropdown component

Handle dropdown menu easily with this Vuejs component.

Requisites

Vuejs >= 2.x

Install

$ npm install vue-my-dropdown

Usage

You can import and insert the component using:

import dropdown from 'vue-my-dropdown'

// Component
export default {
    //...
    components: { dropdown },
    //...
}

Documentation

Official documentation

Changelog

2.1.0

  • Fixed error in IE <= 11.
  • Added positioned event.
  • Changed .babelrc configuration. Now use env preset

LICENSE

The license is MIT. See LICENSE file to more info.

vue-my-dropdown's People

Contributors

davidnotplay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-my-dropdown's Issues

Dropdown isnt showing correctly

Hello, tried the lib and everything seems ok except the css.

image

Thats how the dropdown looks.

The code: (pretty straightforward copy of an example)

<dropdown :visible="visible" @clickOut="visible = false">
  <span class="cont-nav-img" @click="visible = true"><i class="icon-sprites icon-sprites-profile-icon"></i><span class="nav-label"><p>MI PERFIL</p></span></span>
  <div slot="dropdown" class="dialog">
    <aside class="menu">
      <ul class="menu-list">
        <li><a href="#">Item 1</a></li>
        <li><a href="#">Item 2</a></li>
      </ul>
    </aside>
  </div>
</dropdown>

Adding transition delay animation

I want to add transition-delay CSS animation property for the dropdown dialog. However, since the CSS styles for dialog are being set by the props, I am unable to set this. I also tries adding this to '.my--dropdown-dd' class, but it is not working. It is very important for me to achieve this effect. Any suggestions is appreciated.

Property or method "visible" is not defined error

Trying to run an example:

<dropdown :visible="visible" @clickOut="visible = false"> 
<span class="link" @click="visible = true">Click me</span>
<div class="dialog" slot="dropdown">Click out to hide me.</div>
</dropdown>

getting the following error:

"[Vue warn]: Property or method "visible" is not defined",

followed by:

"vue.runtime.esm.js?a427:475 [Vue warn]: Invalid prop: type check failed for prop "visible". Expected Boolean, got Undefined."

Incorrect docs/animation

Its listed as; :animation="animation", however it should be :animation="ani-none'" does not work an error is thrown, but :animation="'ani-none'", with single quotes does.

Typo in Docs/guide

Thanks for the plugin, works as expected ๐Ÿป

For the basic example you have;

<span class="link" @click="visible = !visible">click here</span>
  <div slot="dropdown" class="dialog">
    hello world 
    </div>
</dropdown>

Your missing the opening <dropdown>.

I checked to see if I could contribute, but seems the docs are not open sourced, might want to put them on GitHub. Others can contribute, also that would resolve issue #4 as well (considering there would be a code for having the component work when there are multiple drop downs being used).

Vue 2.0 support

Is this component compatible with Vue2 or do you have any plans for it?

You have error in documentation

There is error In your example with '@clickout="visible = false"'

You write 'clickOut', but event name is 'clickout'.

I saw this in the source code.

Thank's for dropdown!

Dropdown progressively moving when used with absolute positioning

I have a strange issue with a dropdown positioned on a button that is itself absolutely position top-right.

Code: (some details removed for brevity)

<div class="absolute pin-t pin-r">
    <button @click.stop="actionsOpen = !actionsOpen"><icon/></button>
    <vue-my-dropdown :visible="actionsOpen"  :position="[ 'left', 'top', 'right', 'top' ]"/>
</div>
.pin-r {
    right: 0;
}
.pin-t {
    top: 0;
}
.absolute {
    position: absolute;
}

Every time I open the drop-down, it moves over a little bit, until finally it assumes its correct position (:position="[ 'left', 'top', 'right', 'top' ]").

The button: (dots at the top-right)
screenshot 2017-12-21 22 59 57
After first click:
screenshot 2017-12-21 22 59 49
After second click: (ignore the $t tooltip) (note the width change also)
screenshot 2017-12-21 23 00 03
All subsequent clicks: (correct)
screenshot 2017-12-21 23 00 14

Any idea what could be going on?

clickOut event is not working

I'm using your component with vuejs 2.3.4 and the click out event isn't working. The event is emitted but it's not handled by my funtion or whatever i put inside the listener.

I've tried @clickout, @click-out and @clickout, but none of them work.

Dropdown positioning issue

The dropdown is not positioning properly and is behaving differently in different scenarios. The problem lies in the calculation of 'top' and 'left' properties of the div with class 'my-dropdown-dd'. Negating these two properties in the console seems to be doing the trick. Therefore, I think the solution lies in JS rather than CSS, particularly within the function 'setPosition'.

But I don't know how to override this function or the parameters it is setting from my side. Any help would be greatly appreciated.

Positioning in relation to a fixed position element is broken.

Hey, first off, the relevant code:

the HTML

<div  class='foliage-actionbuttons'>
        <div class='foliage-actionbutton' @click.prevent="showDropdown('dropdown11')" id="link11"><i class="fa fa-user" aria-hidden="true"></i>
        </div>
        <div class='foliage-actionbutton last'><i class="fa fa-sign-out" aria-hidden="true"></i></div>
        <my-dropdown id="dropdown11" click-out="" ref-id="link11" :position="['left', 'top', 'right', 'bottom']">
            <div class="dropdown">Click again in the link to hide me.</div>
        </my-dropdown>
    </div>

And the position styling for the parent foliage-actionbuttons div.

.foliage-actionbuttons {
    height: 32px;
    line-height: 32px;
    display: inline-block;
    position: fixed;
    right: 15px;
    bottom: 15px;
}

What I expect is the positioning to be always correct, as your examples demonstrate. Instead, Here's a gif, of how the positioning of the element changes with a few toggles....

gif

As you can see, it goes all over the place, before setting for what's expected at the end.

Open on mouseover doesn't work as expected

Your example with custom event @mouseover="visible = true" shows the dropdown menu but when you try to hover over the menu item it disappears.

So how would i need to make it to work with a navigation menu not a dialog?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.