https://github.com/dafrok/san-mixin
mixin function for san components
https://github.com/dafrok/san-mixin
san
Last synced: 9 months ago
JSON representation
mixin function for san components
- Host: GitHub
- URL: https://github.com/dafrok/san-mixin
- Owner: Dafrok
- License: mit
- Created: 2018-04-23T08:54:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-22T08:06:34.000Z (over 6 years ago)
- Last Synced: 2025-06-26T10:51:50.900Z (about 1 year ago)
- Topics: san
- Language: JavaScript
- Homepage:
- Size: 88.9 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SAN MIXIN
[]()
[](https://www.npmjs.com/package/san-mixin)
[](https://codecov.io/gh/Dafrok/san-mixin)
[]()
## Installation
```
npm i san-mixin
```
## Arguments
- Component {Object} san component
- mixins {Object} mixin prototypes
## Usage
```js
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
```