DualWield / san-mixin

mixin function for san components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SAN MIXIN

Installation

npm i san-mixin

Usage

import mixin from 'san-mixin'

const Component = san.defineComponent({
    initData() {
        return {
            foo: 1
        }
    },
    getBar() {
        console.log(this.data.get('bar'))
    }
})

mixin(Component, {
    initData() {
        return {
            bar: 2
        }
    },
    getFoo() {
        console.log(this.data.get('foo'))
    }
})

const instance = new Component()

console.log(instance.getFoo()) // 1
console.log(instance.getBar()) // 2

About

mixin function for san components

License:MIT License


Languages

Language:JavaScript 100.0%