Cannot call function in vs- dropdown by #click - vue.js

i am using vs dropdown for notification and i need to trigger the function "abc()" when dropdown feather icon is clicked but on clicking the function is not triggered
<div class="bellicon" >
<feather-icon icon="BellIcon" class="cursor-pointer mt-1 sm:mr-6 mr-2" :badge="length1" >
</feather-icon>
</div>
<vs-dropdown-menu class="notification-dropdown dropdown-custom" #change="abc()">
<div class="notification-top text-center p-5 bg-primary text-white">
<h3 class="text-white">{{ unreadNotifications.length }} New</h3>
<p class="opacity-75">App Notifications</p>
</div>
<VuePerfectScrollbar ref="mainSidebarPs" class="scroll-area--nofications-dropdown p-0 mb-10" :settings="settings">
<ul class="bordered-items">
<li v-for="ntf in unreadNotifications" :key="ntf.index" class="flex justify-between px-4 py-4 notification cursor-pointer">
<div class="flex items-start">
<feather-icon :icon="ntf.icon" :svgClasses="[`text-${ntf.category}`, 'stroke-current mr-1 h-6 w-6']"></feather-icon>
<div class="mx-2">
<span class="font-medium block notification-title" :class="[`text-${ntf.category}`]">{{ ntf.title }}</span>
<small>{{ ntf.start }} {{ ntf.total }}{{ ntf.msg }}</small>
</div>
</div>
<small class="mt-1 whitespace-no-wrap">{{ elapsedTime(ntf.time) }}</small>
</li>
</ul>
</VuePerfectScrollbar>
<div class="
checkout-footer
fixed
pin-b
rounded-b-lg
text-primary
w-full
p-2
font-semibold
text-center
border
border-b-0
border-l-0
border-r-0
border-solid
border-grey-light
cursor-pointer">
<span>View All Notifications</span>
</div>
</vs-dropdown-menu>
</vs-dropdown>
the function abc() contains console.log but it is not working

The #change will not be invoked on click. This will only be invoked when an option is selected. Try changing it to #click. If you're having issues with the framework, you can make your own drop-down that will work. Something like that is done here: https://codepen.io/diemah77/pen/avabWG
Also, please keep in mind that VS is, as stated by their developers, not ready for production code, so there may be bugs in the framework itself that cause unexpected behavior even if your code is proper.
The truth is, Vuesax has a long way to go in terms of development. Components must be created, improved and fixed. For now, Vuesax should not be used for a real application. However, we are working very hard to achieve the stable version and have the strength to use it in any application.

vsDropdown component emits click event when you click on dropdown:
Source Code
So your code just needs a little bit of update:
First of all, you didn't add full code because vs-dropdown start tag is missing. That's where you should listen to click event.
So code looks like this:
<template lang="html">
<div class="examplex">
<!-- ATTENTION 👀 -->
<vs-dropdown #click="hello">
<a class="a-icon" href="#">
Dropdown hover
<vs-icon icon="expand_more"></vs-icon>
</a>
<vs-dropdown-menu>
<vs-dropdown-item>
Option 1
</vs-dropdown-item>
</vs-dropdown>
</div>
</template>
<script>
export default {
methods: {
hello() {
console.log('object');
}
}
}
</script>
<style lang="stylus">
.examplex
display: flex;
align-items: center;
justify-content: center;
.a-icon
outline: none;
text-decoration: none !important;
display: flex;
align-items: center;
justify-content: center;
i
font-size: 18px;
</style>
Notice that <vs-dropdown #click="hello"> that's your way out.
I hope this will resolve your issue. 🥂

Related

Vue Accordion: Override SCSS value

I'm using this accordion on my vue project: https://github.com/tkhquang/vue-simple-accordion#html-structure
I'm having trouble overriding the style on the button. The class name is "vsa-item__trigger" but I can't figure out a way to attach my style to it. The scss is in a style tag within my component. This is what my code looks like now:
<vsa-list>
<vsa-item v-for="item in listOfItems" :key="item.id">
<vsa-heading>
<label for="acc1 acc-label"> {{ item.heading }} </label>
</vsa-heading>
<vsa-content>
<ul class="mobile-ul-accordian">
<li class="mobile-li-accordian">
<a :href="item.url">{{ item.content }}</a>
</li>
</ul>
</vsa-content>
</vsa-item>
</vsa-list>
button.vsa-item__trigger[type="button"][aria-expanded="false"] [data-vsa-list="14"] [data-vsa-item="15"] [data-vsa-active="false"] [aria-controls="vsa-panel-15"]{
border: none !important;
}
I just simplyfied your selector and this worked for me. Also on JSFiddle.
<button
class="vsa-item__trigger"
type="button"
aria-expanded="true"
aria-controls="vsa-panel-{item_id}"
{data_attrs}
>
<span
class="vsa-item__trigger__content"
{data_attrs}
>
This is the heading
</span>
<span
class="vsa-item__trigger__icon vsa-item__trigger__icon--is-active"
{data_attrs}
>
</span>
</button>
button.vsa-item__trigger {
border: none !important;
}

How to make modal popup window in Vuejs?

<style src="./LoginButton.scss" lang="scss"></style>
<i18n src="./LoginButton.txt"></i18n>
<script src="./LoginButton.js"></script>
<template>
<div class="header-login component-same ml-10">
<span v-if="showLoggedIn">
<router-link :to="{ name: 'user' }" data-test="login-info-name">
<i class="dl-icon-user12"></i>
<span class="target-text hidden-xs hidden-sm">{{
$t('myAccount')
}}</span>
</router-link>
</span>
<!-- <span v-if="showLoggedIn" class="hidden-xs">
<a #click="logout" data-test="logout-button">
<span>{{ $t("signOut") }}</span>
</a>
</span>-->
<span v-else data-test="login-button">
<router-link :to="{ name: 'login' }">
<i class="dl-icon-user12"></i>
<span class="target-text hidden-xs hidden-sm">{{ $t('Register') }}</span>
</router-link>
</span>
</div>
</template>
I have written the above code for login, Where in this particular line
User has a register button, As soon as the user clicks on the register button, the User will be redirected to another page where he can fill up the basic details, So Instead of redirecting into another page, I want the Register button as a Popup, wherein the popup user can enter details.
also, I tried bootstarp-vue but I wasn't able to find the solution.
It's easier than what you think and mostly you won't need a special CSS lib for that, so the thing to do is just to make another component and call it whatever you want(but modal.vue makes sense here):
//inside modal.vue:
<template>
<div className="modal__wrapper">
<div className="modal">
<slot/>
</div>
</div>
</template>
<style lang="scss" scoped>
.modal{
width: 300px;
height: 100px;
border-radius: 10px;
background-color: white;
padding: 20px 20px;
z-index: 1200;
&__wrapper{
background-color: rgba(0,0,0,0.4);
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
position: absolute;
top: o;
}
}
</style>
in its simplest form, it's just a component with some styling to make it look like a modal (a transparent background(to make it look it's over the previous page) and an absolute position for its wrapper(the transparent one) and some centering techniques for its actual content),I didn't put any script in it(because it's just a simple modal I'm showing you to give the idea how to make yours) and then there is this slot part meaning you can pass your registration form to this modal component, from your parent component and use a boolean flag to just show it on register click
(sure you might need to add some more CSS to the .modal class):
<i18n src="./LoginButton.txt"></i18n>
<script src="./LoginButton.js"></script> <!-- the cleaner thing would
be to import them in your script section somehow -->
<template>
<div class="header-login component-same ml-10">
<span v-if="showLoggedIn">
<router-link :to="{ name: 'user' }" data-test="login-info-name">
<i class="dl-icon-user12"></i>
<span class="target-text hidden-xs hidden-sm">{{
$t('myAccount')
}}</span>
</router-link>
</span>
<span v-else data-test="login-button">
<!-- no need to rerouting to another path -->
<Modal>
<!--your template for registration will go here-->
<i class="dl-icon-user12"></i>
<span class="target-text hidden-xs hidden-sm">{{ $t('Register') }}</span>
</Modal>
</span>
</div>
</template>
//you gotta import the modal component so in your script section you have sth like this(BTW what type of structure are you using for your project? are you using vue-cli's scaffold or what? Are you using babel? cuz I'm gonna assume you are!)
<script>
import Modal from 'The_Relative_Path_to_the_Modal_you_just_created';
export default {
components:{
Modal
},
data(){
return{
showLoggedIn: false
}
}
}
</script>
<style src="./LoginButton.scss" lang="scss"></style>

In Element-ui,click the elect or checkbox in dialog shaking

There is a demo
http://jsfiddle.net/sqghggak/
When I click the checkbox or select it, it takes a shake. How can I fix it?
I tried to add overflow: scroll this to the .el-dialog__wrapper, but it was useless.
ok,I got the same error
<el-dialog title="权限设置" v-model="isShowPermission" style="overflow: scroll">
<div v-for="sub of permissions">
<el-checkbox #change="subchange(sub)" v-model="sub.ischeck">{{sub.subname}}</el-checkbox>
<div style="margin-left: 20px;" v-for="sub_ of sub.subpermission">
<el-checkbox #change="sub_change(sub,sub_)" v-model="sub_.ischeck">{{sub_.subname}}</el-checkbox>
<div style="margin-left: 20px;">
<el-checkbox v-for="sub__ of sub_.subpermission" #change="sub__change(sub,sub_,sub__)"
v-model="sub__.ischeck">{{sub__.subname}}
</el-checkbox>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button #click="isShowPermission = false" size="small">取 消</el-button>
<el-button type="primary" size="small" #click="handleSavePermission"
:loading="dialogloading">确 定</el-button>
</span>
</el-dialog>
The checkbox dialog is dynamically generated.When a chebox selected,it will shake a little.
However, 'overflow: scroll' solved the problem
try to add style below to avoid this problem, it works for me :)
.el-select .el-input {
overflow: scroll;
padding-bottom: 1px;
}

Bootstrap 2 carousel second slide disappears

We are using Bootstrap 2 on a Joomla 3.2.2 site. See: http://test.stuntlist.com/west
The first slide works perfectly, but when the second slide comes in, it disappears. You can see it start to transition between the slides, but then the area where the slide should be just disappears and the content is moved up into the slide area.
I don't see any JS errors on the site. We have used the same carousel code on other sites without this issue.
Here is the carousel code:
<div class="slideshow">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active">
<a href="/component/joomgallery/action-photos?Itemid=88"><span data-picture data-alt="">
<span data-src="/images/hero/slide01.jpg"></span>
<span data-src="/images/hero/portrait/slide01mobile.jpg" data-media="(max-width: 768px) and (orientation:portrait)"></span>
<noscript><img src="/images/hero/slide01.jpg" alt=""></noscript>
</span></a>
<div class="carousel-caption">
<div class="container">
<h4>Slide Caption Goes Here.</h4>
</div>
</div>
</div>
<div class="item">
<span data-picture data-alt="">
<span data-src="/images/hero/slide02.jpg"></span>
<span data-src="/images/hero/portrait/slide02mobile.jpg" data-media="(max-width: 768px) and (orientation:portrait)"></span>
<noscript><img src="/images/hero/slide02.jpg" alt=""></noscript>
</span>
<div class="carousel-caption">
<div class="container">
<h4>Second Caption.</h4>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
</div>
</div>
Any idea what could be causing the problem?
Thank you.
This is caused due to a conflict with Mootools, download the following plugin and apply your preferences and it'll resolve this problem:
https://extensions.joomla.org/extension/mootools-enabler-disabler
The problem is Joomla adds another DIV (We will call it JDIV) outside the Carousel container, when second/EVEN Numbered Slides are viewed some script sets the height of the JDIV equal to "0px", see my code below
<div class="col-sm-12 pharma">
<!-- this is the div which joomla is adding (JDIV) -->
<div style="margin: 0px; position: relative; overflow: hidden; height: 0px;">
<!-- this is the div which joomla is adding (JDIV) -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="margin: -203px 0px 0px; overflow: hidden;">
<div class="carousel-inner">
....
</div>
<div class="ind-div">
<ol class="carousel-indicators">
....
</ol>
</div>
</div>
</div>
</div>
The Solution
This solution worked for me and should also work for you too.
Add a CSS class named "#myCarousel" ( ID of the carousel) and sets its margin to 0px with important,
#myCarousel{ margin:0px !important; }
Secondly add another CSS class like
.pharma>div{ height:204px !important; }
where .pharma is the class which I have used on the DIV which is outside the JDIV. The height will be different from what I have used and might have to use media queries if using responsive.
To find the height simply inspect the element and note the height of the first slide and use that height in CSS class.
I do not have a fix for you but I was able to find a few issues. The first and biggest issue being that you have inline styling that is causing the image to "disappear". The image is really just moved 572px upwards and is off the screen. Notice the two images below. The first link is the image that does work. The second link is the image that does not display.
http://tinypic.com/r/hthi4y/8
http://tinypic.com/r/2hoix35/8
Using chrome, I opened the developer console and manually changed the margin to 0px instead of -572px and it fixed the issue. I would take a look at your JS again and see what values are being applied to each image because the entire display is being rendered dynamically, I assume for mobile devices.

Adding many buttons to header in JQuery Mobile

I know that we can add left and right buttons in a header in Jquery Mobile App.
But can we any more buttons or controls in the header section itself?
I think I have a better solution,
<header data-role ="header" data-theme="b">
<h1 class="ui-title" role="heading">Staff</h1>
<div class="ui-btn-right" data-role="controlgroup" data-type="horizontal">
filter
move
</div>
</header>
Screenshot;
with regard to this info:
you can find it here:
http://www.metaltoad.com/sites/default/files/Responsive-Widths_0.png
you can use this code:
<style type="text/css">
#media all{
.my-header-grid.ui-grid-b .ui-block-a { width: 30%; }
.my-header-grid.ui-grid-b .ui-block-b { width: 40%; }
.my-header-grid.ui-grid-b .ui-block-c { width: 30%; }
}
}
</style>
<div class="my-header-grid ui-grid-b" data-theme="a">
<div class="ui-block-a ui-bar-a" data-theme="a">
<div align="left" style="padding-left:5px;padding-top:3px;height:33px;height:40px;">
Back
Edit
</div>
</div>
<div class="ui-block-b ui-bar-a">
<div align="center" style="padding-top:3px;height:33px;text-align:center;height:40px;">
<div style="padding-top:7px;">
<article role="heading" aria-level="1">expand </article>
</div>
</div>
</div>
<div class="ui-block-c ui-bar-a">
<div align="right" style="padding-top:3px;height:33px;height:40px;">
Add
Refresh
</div>
</div>
</div><!-- /grid-b -->
if by any chance your programming with c# mvc razor engine don't forget to write the css media tag with 2 # like so ##media because the razor engine treats 2 # as one.
you see and can play with all of the designs shown here in this link:
http://jsfiddle.net/yakirmanor/BAat8/
iv added some links but i recommend youll read this:
http://appcropolis.com/blog/advanced-customization-jquery-mobile-buttons/
the simple implantation is:
<header data-role ="header" data-theme="a">
<a data-icon="back" href="/" rel="external">Back</a>
<h1 class="ui-title" role="heading">Staff</h1>
<a class="ui-btn-right" data-icon="back" href="#" rel="external">Refresh</a>
</header>
or this:
<div data-role="header" data-theme="b">
<a data-icon="back" href="/" rel="external">Back</a>
<h1 class="ui-title" role="heading">Staff</h1>
<div class="ui-btn-right" data-role="controlgroup" data-type="horizontal">
filter
move
</div>
</div>
or this:
<div data-role="header" data-theme="e">
<div class="ui-btn-left" data-role="controlgroup" data-type="horizontal">
filter
move
</div>
<h1 class="ui-title" role="heading">Staff</h1>
<div class="ui-btn-right" data-role="controlgroup" data-type="horizontal">
filter
move
</div>
</div>
hope iv helped.
It might be easier to create a custom navbar instead of modifying the header toolbar, Here si the docs: http://jquerymobile.com/demos/1.0a4.1/#docs/toolbars/docs-navbar.html
This might help:
<div class="ui-btn-right">
<!-- Home Button -->
<a href="index.html" data-role="button"
data-icon="refresh" data-iconpos="notext" data-direction="reverse" data-corners="true"
data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" title="Refresh">
</a>
<!-- Home Button -->
<a href="index.html" data-role="button"
data-icon="home" data-iconpos="notext" data-direction="reverse" data-corners="true"
data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" title="Home">
</a>
</div>
This gives me those nice rounded buttons, two side by side on the right side.
Just like on the mobile docs.
Works in 1.1.1, haven't tried the latest RC
I was able to achieve this by the following code:
<div data-role ="header" data-theme="b">
Prev
<div data-role="controlgroup" data-type="horizontal" style="margin-left:75px;margin-top:5px;" >
<a href="index.html" data-role="button" data-icon="arrow-l" >P.Week</a>
N.Week
</div>
Next
</div>
No, there is a hard limit of 2 as far as I have found. The best I was able to come up with was to get another unstyled link to appear.
There are however, navbars - On one of my projects, I needed a number of buttons in the header area, I placed a navbar directly below it, and was reasonable pleased with the results.
They are explained in detail here:
http://jquerymobile.com/test/docs/toolbars/docs-navbar.html