Vue method called when clicking on component elementHow do I detect a click outside an element?HTML “overlay” which allows clicks to fall through to elements behind itPure JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for itReact functional stateless component, PureComponent, Component; what are the differences and when should we use what?VueJS - How to call event on child component from parent v-forVue 2 Component not calling main instance functionHow to save reference to “this” in Vue component?Vue :click is being triggered automatically inside v-forVue js - making a style to be inherited by children componentsAccess to DOM element with Vue method
Inverse-quotes-quine
Why is Madam Hooch not a professor?
Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?
Fedora boot screen shows both Fedora logo and Lenovo logo. Why and How?
How come I was asked by a CBP officer why I was in the US?
What are the penalties for overstaying in USA?
Is this one of the engines from the 9/11 aircraft?
How to determine what is the correct level of detail when modelling?
Why is C++ initial allocation so much larger than C's?
When is it ok to add filler to a story?
Why cruise at 7000' in an A319?
What's the difference between 予定 (Yotei) and 計画 (keikaku)?
How well known and how commonly used was Huffman coding in 1979?
Going to get married soon, should I do it on Dec 31 or Jan 1?
How could mana leakage be dangerous to a elf?
Does anycast addressing add additional latency in any way?
Should I include salary information on my CV?
Are neural networks the wrong tool to solve this 2D platformer/shooter game? Is there a proven way to frame this problem to a neural network?
Should my manager be aware of private LinkedIn approaches I receive? How to politely have this happen?
How can Charles Proxy change settings without admin rights after first time?
Does the posterior necessarily follow the same conditional dependence structure as the prior?
Using “sparkling” as a diminutive of “spark” in a poem
Singing along to guitar chords (harmony)
How dangerous are set-size assumptions?
Vue method called when clicking on component element
How do I detect a click outside an element?HTML “overlay” which allows clicks to fall through to elements behind itPure JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for itReact functional stateless component, PureComponent, Component; what are the differences and when should we use what?VueJS - How to call event on child component from parent v-forVue 2 Component not calling main instance functionHow to save reference to “this” in Vue component?Vue :click is being triggered automatically inside v-forVue js - making a style to be inherited by children componentsAccess to DOM element with Vue method
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Strange behavior, I have function called sum.
This functions should be called once (after getting data from the server, and it's what happening)
but then it's getting called every time I click on other elements in the component...it could be even select element or date selector...everything that have v-model defined (I think)
What I'm missing here?
Thanks!
<td><span>_sum('device')</span></td>
** important : this td element is not defined inside loop.

javascript vue.js vuejs2
add a comment |
Strange behavior, I have function called sum.
This functions should be called once (after getting data from the server, and it's what happening)
but then it's getting called every time I click on other elements in the component...it could be even select element or date selector...everything that have v-model defined (I think)
What I'm missing here?
Thanks!
<td><span>_sum('device')</span></td>
** important : this td element is not defined inside loop.

javascript vue.js vuejs2
Why are you calling a function from the expression? Why don't you usecomputedproperties?
– varit05
Mar 25 at 11:13
@varit05 cause I'm getting error "TypeError: _vm._sum is not a function"
– Avib
Mar 25 at 11:48
add a comment |
Strange behavior, I have function called sum.
This functions should be called once (after getting data from the server, and it's what happening)
but then it's getting called every time I click on other elements in the component...it could be even select element or date selector...everything that have v-model defined (I think)
What I'm missing here?
Thanks!
<td><span>_sum('device')</span></td>
** important : this td element is not defined inside loop.

javascript vue.js vuejs2
Strange behavior, I have function called sum.
This functions should be called once (after getting data from the server, and it's what happening)
but then it's getting called every time I click on other elements in the component...it could be even select element or date selector...everything that have v-model defined (I think)
What I'm missing here?
Thanks!
<td><span>_sum('device')</span></td>
** important : this td element is not defined inside loop.

javascript vue.js vuejs2
javascript vue.js vuejs2
asked Mar 25 at 11:00
AvibAvib
288 bronze badges
288 bronze badges
Why are you calling a function from the expression? Why don't you usecomputedproperties?
– varit05
Mar 25 at 11:13
@varit05 cause I'm getting error "TypeError: _vm._sum is not a function"
– Avib
Mar 25 at 11:48
add a comment |
Why are you calling a function from the expression? Why don't you usecomputedproperties?
– varit05
Mar 25 at 11:13
@varit05 cause I'm getting error "TypeError: _vm._sum is not a function"
– Avib
Mar 25 at 11:48
Why are you calling a function from the expression? Why don't you use
computed properties?– varit05
Mar 25 at 11:13
Why are you calling a function from the expression? Why don't you use
computed properties?– varit05
Mar 25 at 11:13
@varit05 cause I'm getting error "TypeError: _vm._sum is not a function"
– Avib
Mar 25 at 11:48
@varit05 cause I'm getting error "TypeError: _vm._sum is not a function"
– Avib
Mar 25 at 11:48
add a comment |
1 Answer
1
active
oldest
votes
Ok, got it...the solution is to attach the main object
(the one who responsible for the table data) to a watch property.
Now only when the table items getting an update the function will execute.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336305%2fvue-method-called-when-clicking-on-component-element%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Ok, got it...the solution is to attach the main object
(the one who responsible for the table data) to a watch property.
Now only when the table items getting an update the function will execute.
add a comment |
Ok, got it...the solution is to attach the main object
(the one who responsible for the table data) to a watch property.
Now only when the table items getting an update the function will execute.
add a comment |
Ok, got it...the solution is to attach the main object
(the one who responsible for the table data) to a watch property.
Now only when the table items getting an update the function will execute.
Ok, got it...the solution is to attach the main object
(the one who responsible for the table data) to a watch property.
Now only when the table items getting an update the function will execute.
answered Mar 25 at 12:43
AvibAvib
288 bronze badges
288 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336305%2fvue-method-called-when-clicking-on-component-element%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why are you calling a function from the expression? Why don't you use
computedproperties?– varit05
Mar 25 at 11:13
@varit05 cause I'm getting error "TypeError: _vm._sum is not a function"
– Avib
Mar 25 at 11:48