@m9ch/pumpkin
v0.1.0-alpha.1
Published
A SHIELD for pinia & Vue3
Downloads
2
Readme
pumpkin
Install
via npm, yarn or pnpm:
$ npm install --save @m9ch/pumpkin
# or yarn
$ yarn add @m9ch/pumpkin
# or pnpm
$ pnpm add @m9ch/pumpkin
Usage
- create a pumpkin instance:
import { createPumpkin } from '@m9ch/pumpkin'
import App from './App.vue'
const app = createPumpkin(App)
- define a model and mount it to the app:
const base = {
namespace: 'base',
state: () => ({
msg: 'hello world',
}),
actions: {
updateMsg (msg) {
this.msg = msg
},
},
}
// mount the model to the app
app.model(base)
- connect it to a component:
const App = (props) => {
return () => <h3>{props.msg}</h3>
}
const mapToProps = ({ base }) => ({
msg: base.msg,
})
export default connect(mapToProps)(App)
- start the app!
app.start('#app')
checkout more details in ./examples.
made with :heart: by Mitscherlich