question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Official way to call a method from outside the view model.

See original GitHub issue

I’m trying to integrate Vue into a Backbone.js app. What is the official way for outside code to call a method in Vue? Is it something like:

// inside the Backbone.View
this.vue = new Vue({ methods: { myFunc : function(){} } } );
this.vue.methods.myFunc.call(this.vue);

Thanks!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
yyx990803commented, Jun 25, 2014

You can just do this.vue.myFunc(). All methods are present on the created vm.

0reactions
ricky11commented, Oct 23, 2021

would it be possible to expose a vue method from a component? so far i can only do as long as the method is within the vue instance creation, but i suppose that it would be possible from a component as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Knockout.js calling method outside of view model
If you want to call a method of your view model from the outside, just make an instance: var userModel = new userHealthModel();...
Read more >
How to call function OUTSIDE of viewModel from a ko ...
I have a fairly complicated viewModel that is mapped using ko.mapping from a JSON object. This works: <span data-bind="text: decTotalPrice"></ ...
Read more >
How to call a method from another class - Apple Developer
I want to call my hideBirthFrameOutlet2 method from outside my ViewController1 class. I want to call it from within ViewController2 from within this...
Read more >
Calling a Method of a Control in the View, from the ViewModel
1) In MVVM if you use ViewModel first technology you simply create and hold the Main Views handle from the ViewModel. Simply do...
Read more >
Laravel view models - Stitcher.io
For example, you can pass a view model directly to the view function if the view model implements Arrayable . public function create()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found