Why does the function work except #click? [closed] - vue.js

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I using Vue3 and firestore
Here's my problem.
<textarea class="form-control v-model="form.comment" #keypress.enter="saveComment" required></textarea>
<button #click="saveComment">save</button>
#keypress.enter="saveComment" is works
but
#click="saveComment" did not work.
I don't know what's the difference between these two.
I used saveComment in the methods: {} in the script.
edited
When I ran the function through #keypress.enter, the page was not refreshed
But when I ran the function through #click, the page was refreshed and the function was not executed.
So I added a prevent.submit and it works well.

Considering the fact that you only shared little information on your question, I would be answering based on some assumptions.
The keypress event is an event emitted when a key that emits is character is pressed (this event is already deprecated according to MDN, so you might want to consider keyup/letdown event).
However, you should note that the #keypress.enter event according to Vuejs would only be emitted when an individual clicks on the enter Key.
#click event on the other hand would be emitted when a click event is observed on such element, in this case a button.

Related

Vue.js - Post method not working when pressing button [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Whenever I try to click on the button it doesn't add any records. But when I put on the input field #keyup.enter="addusers" Then it's working when I press enter. I want it to work with Add button. Can someone give me advice.
.row
input(type='text', v-model='newUser')
input(type='text', v-model='newMail')
button.btn.btn-primary(type='button' #onclick="addUsers") Add
.col-lg-12.text-left(v-for="user in users")
p {{ user.name}}- {{user.email}}
addUsers() {
axios.post('https://jsonplaceholder.typicode.com/users', {
name: this.newUser,
email: this.newMail
})
.then(({data}) => {
this.users.push(data);
});
the click event should be written #click instead of #onclick
button.btn.btn-primary(type='button' #click="addUsers") Add

Back button navigation without reload the previous page in vue js [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
i have created 3 pages, first page is navigating to second page and second page is navigating to 3rd page, how ever when i click back button it is navigating to previous page but its not giving last history intead of its reloading the page,
This is normal as the previous component's instance is destroyed. You can console.log in each lifecycle hook to see which hooks are called when a route is entered and exited.
To prevent this behaviour and cache your route's component you can wrap the <router-view> inside <keep-alive>
<keep-alive>
<router-view></router-view>
</keep-alive>
You can even pass include and exclude props on <keep-alive> to manage which component to or not be cached

Vue.js 2 datepicker recommendation? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm looking for recommendations for a Vue.js 2.0 date picker component. My requirements are fairly simple.
Should have option to pick a range - start date, end date.
Should be stylable.
Should be able to trigger a method when a date is selected.
I've been using https://github.com/charliekassel/vuejs-datepicker so far, which is good but doesn't have the range option (unless I've missed it). This one looks promising - https://github.com/mengxiong10/vue2-datepicker - but I don't immediately see how I can trigger a method when a date is selected.
There is a component family called Element, here is the DatePicker. You can import only the DatePicker if you want (Check the "On demand" part here).
It supports range selection (type="daterange").
There is also at least two ways to catch the selection event. It has a change event, and also with the picker-options prop you can pass an onPick callback.
I am not sure about the custom styling, as I can see there is a way to give a custom class for the dropdown with the popper-class prop but I am not sure how that works.

What is the difference between id and tagname? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
An Interviewer asked this question in selenium webdriver
Please let me know the answer of this question
Thanks
Srinu Marri
Tags
are HTML elements, like
<div>, <ul> , <p> , <h1> , etc
Id's
are ATTRIBUTES of tag names. For example:
a <div> tag can be given an id:
<div id='firstdiv' >
or a class name:
<div class="firstdiv">
ID
Identify uniquely HTML elements. Even if you add more than one ID inside a html page, the DOM object will render all elements even with the same ids, but if selected by JavaScript or selenium only will select the first one that is rendered.
E.g:
findElements(By.id("id"), Selenium will return an element with this id attribute that are present immediately after the page loads.
tagname
Works just like class elements. Can identify a element behavior or even a constant markup. The DOM object can handle with multiples elements and even scripts tags.
E.g: findElements(By.tagName("table"), Selenium will return an array of all the tables that are present immediately after the page loads.

selenium Mosue Over not working if hover property is defined in CSS [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Selenium is not able to perform mouseOver if Hover property is defined in CSS
You can try yourself on this link using selenium ide
http://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_link_more2
Selenium mouse Over has no effect on this link
please visit this link
According to this question, this is one of those perennial problems Selenium and :hover css
They discuss a couple of solutions, but it looks like the problem is that as Javascript cannot trigger the :hover pseudo class, so Selenium can't either.