omi-html

0.3.0 • Public • Published

omi-html

Using htm in omi.

→ online demo

Usage

import { define, render, WeElement } from 'omi'
import 'omi-html'

define('my-counter', class extends WeElement {
  static observe = true

  data = {
    count: 1
  }

  sub = () => {
    this.data.count--
  }

  add = () => {
    this.data.count++
  }

  render() {
    return html`
      <div>
        <button onClick=${this.sub}>-</button>
        <span>${this.data.count}</span>
        <button onClick=${this.add}>+</button>
      </div>`
  }
})

render(html`<my-counter />`, 'body')

Syntax highlighting

License

MIT © dntzhang

Readme

Keywords

Package Sidebar

Install

npm i omi-html

Weekly Downloads

5

Version

0.3.0

License

MIT

Unpacked Size

1.96 kB

Total Files

2

Last publish

Collaborators

  • dntzhang