neutronium-vue-simple-command-mixin
v1.1.0
Published
Vue mixin to integrate MVVM ISimpleCommand with vue.js
Downloads
3
Maintainers
Readme
neutronium vue simple command mixin
Usage
Provide mixin to easily integrate ISimpleCommand in vue.js using Neutronium. Component this mixin exposes:
Props
command
Type: Array
Required: true
The property corresponding to the C# command.
arg
Type: Object
Required: false
The argument that will be passed to command when execute is called.
Methods
execute
Call the corresponding command with the argument arg
Events
beforeExecute
Called before calling command execute if CanExecute is true.
The event argument provides two properties:
arg
:Object
the command argument,cancel
:false
set it to true to cancel the execution
afterExecute
Called after calling command execute.
The event argument is the command argument.
Example
Declaring buttonCommand component in a .vue file (using semantic ui):
<template>
<div class="ui button" :arg="param" @click="execute">
<slot></slot>
</div>
</template>
<script>
import comandMixin from 'neutronium-vue-simple-command-mixin'
export default {
mixins:[comandMixin]
}
</script>
<style>
</style>
Using button-command:
<button-command :command="compute">
Submit
</button-command>
Installation
- Available through:
npm install neutronium-vue-simple-command-mixin --save