Home

Awesome

<p align="center"><img width="100" src="https://github.com/NeutroniumCore/neutronium-vue-root-vm-access/raw/master/__doc__/logo.png"></p> <h1 align="center">neutronium-vue-root-vm-access</h1>

MIT License

Description

Plugin to access Neutronium root ViewModel from any components.

Installed by default by vue-cli-plugin-neutronium

Install

$ npm install neutronium-vue-root-vm-access

Usage

In install.js file add:

import VmAccess from "neutronium-vue-root-vm-access";

function vueInstanceOption(vm, Vue) {
  Vue.use(VmAccess, vm);
  ///
}

Then to access root ViewModel in a component use this.$rootVm:

methods:{
    changeLanguage(value) {
        this.$rootVm.Language = value;
    }
}