Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.
/ viscum Public archive

A micro data-driven FE framework for writing simple component.

License

Notifications You must be signed in to change notification settings

yusangeng/viscum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Viscum

A micro(7K) data-driven FE framework for simple component.

Install

npm i viscum --save

Usage

js:

import { Widget } from 'viscum'

const { on$ } = Widget

class Button extends Widget {
  @on$('click', '.btn')
  onClick () {
    alert('foobar')
  }

  render () {
    return <div class='btn-wrap'>
      <button class='btn'>{this.data.text}</button>
    </div>
  }
}

class App extends Widget {
  render () {
    return <div>
      <Button text={this.data.buttonText} />
    </div>
  }
}

const app = new App({
  data: {
    buttonText: 'Foo'
  }
})

app.mount('#app')

setTimeout(_ => {
  app.update({
    text: 'Bar'
  })
}, 1000)

html:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>Demo</title>
</head>
<body>
  <div id="app"></div>
</body>
</html>

About

A micro data-driven FE framework for writing simple component.

Resources

License

Stars

Watchers

Forks

Packages

No packages published