Github Slots
Universal dropdown menu component for Vue. Any element can be dropdown trigger and anything can be dropdown content.
In their essence, scoped slots are just a more powerful superset of 'regular' slots. But since introducing them needed a slightly different API, Vue 2 had to distinguish between $slots and $scopedSlots. Vue 3 took the chance and unified both APIs. The less powerful old slots are gone and the old scoped slots are now just called 'slots'. # Slots This slot is the element that triggers the dropdown. It can be any HTML element, the components surrounds it with a div which handles the events like hover/click etc. This slot is the content of the dropdown menu.
Fully customizable - supports left/right opening, open on hover/click, interactive mode ...
# Installation
or
import to use:
# Example
- GitHub Gist: instantly share code, notes, and snippets. //disable control until the slots reach max speed //check every 100ms if slots have reached max speed.
- Fan run database for One Piece Treasure Cruise. Includes a character database with all unit captain abilities, descriptions, sailor abilities, and special abilities.
translate-fade-down.css
# Demo source
# Props
Prop | Type | Default | Description |
---|---|---|---|
value | Boolean | false | Opens/closes the dropdown. The component uses v-model to control the state of the dropdown. |
right | Boolean | false | Whether to stick the dropdown on the right side of the element. |
hover | Boolean | false | If true the menu is open on hover (after hover_time) else it is open on click. |
closeOnClickOutside | Boolean | true | Should the menu close when clicked outside |
hover_time | Integer | false | Time before the menu opens in hover model. Default: 100ms |
transition | String | ' | The vue transition name used to open the menu. |
# Slots
# default
Github Slots Games
This slot is the element that triggers the dropdown. It can be any HTML element, the components surrounds it with a div which handles the events like hover/click etc.
# dropdown
This slot is the content of the dropdown menu.
Github Slate
import random |
print(''Welcome to the Slot Machine Simulator |
You'll start with $50. You'll be asked if you want to play. |
Answer with yes/no. you can also use y/n |
No case sensitivity in your answer. |
For example you can answer with YEs, yEs, Y, nO, N. |
To win you must get one of the following combinations: |
BARtBARtBARttpayst$250 |
BELLtBELLtBELL/BARtpayst$20 |
PLUMtPLUMtPLUM/BARtpayst$14 |
ORANGEtORANGEtORANGE/BARtpayst$10 |
CHERRYtCHERRYtCHERRYttpayst$7 |
CHERRYtCHERRYt -ttpayst$5 |
CHERRYt -t -ttpayst$2 |
'') |
#Constants: |
INIT_STAKE = 50 |
ITEMS = ['CHERRY', 'LEMON', 'ORANGE', 'PLUM', 'BELL', 'BAR'] |
firstWheel = None |
secondWheel = None |
thirdWheel = None |
stake = INIT_STAKE |
def play(): |
global stake, firstWheel, secondWheel, thirdWheel |
playQuestion = askPlayer() |
while(stake != 0 and playQuestion True): |
firstWheel = spinWheel() |
secondWheel = spinWheel() |
thirdWheel = spinWheel() |
printScore() |
playQuestion = askPlayer() |
def askPlayer(): |
'' |
Asks the player if he wants to play again. |
expecting from the user to answer with yes, y, no or n |
No case sensitivity in the answer. yes, YeS, y, y, nO . . . all works |
'' |
global stake |
while(True): |
answer = input('You have $' + str(stake) + '. Would you like to play? ') |
answer = answer.lower() |
if(answer 'yes' or answer 'y'): |
return True |
elif(answer 'no' or answer 'n'): |
print('You ended the game with $' + str(stake) + ' in your hand.') |
return False |
else: |
print('wrong input!') |
def spinWheel(): |
'' |
returns a random item from the wheel |
'' |
randomNumber = random.randint(0, 5) |
return ITEMS[randomNumber] |
def printScore(): |
'' |
prints the current score |
'' |
global stake, firstWheel, secondWheel, thirdWheel |
if((firstWheel 'CHERRY') and (secondWheel != 'CHERRY')): |
win = 2 |
elif((firstWheel 'CHERRY') and (secondWheel 'CHERRY') and (thirdWheel != 'CHERRY')): |
win = 5 |
elif((firstWheel 'CHERRY') and (secondWheel 'CHERRY') and (thirdWheel 'CHERRY')): |
win = 7 |
elif((firstWheel 'ORANGE') and (secondWheel 'ORANGE') and ((thirdWheel 'ORANGE') or (thirdWheel 'BAR'))): |
win = 10 |
elif((firstWheel 'PLUM') and (secondWheel 'PLUM') and ((thirdWheel 'PLUM') or (thirdWheel 'BAR'))): |
win = 14 |
elif((firstWheel 'BELL') and (secondWheel 'BELL') and ((thirdWheel 'BELL') or (thirdWheel 'BAR'))): |
win = 20 |
elif((firstWheel 'BAR') and (secondWheel 'BAR') and (thirdWheel 'BAR')): |
win = 250 |
else: |
win = -1 |
stake += win |
if(win > 0): |
print(firstWheel + 't' + secondWheel + 't' + thirdWheel + ' -- You win $' + str(win)) |
else: |
print(firstWheel + 't' + secondWheel + 't' + thirdWheel + ' -- You lose') |
play() |
commented Dec 14, 2015
Instead of; Do; |
commented Jun 2, 2017
Github Sloth
I run it on python 2 ,it's need to modify the 43 line (input -> raw_input) |