san-mixin

mixin function for san framework

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

HomePage

https://github.com/Dafrok/san-mixin#readme

Repository

git+https://github.com/Dafrok/san-mixin.git


相关推荐