0.0.31 • Published 3 years ago

originaljs v0.0.31

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

例子

基本

js
import OG from "originaljs";

class HelloWorld extends OG.createElement(){
  name="World";
  render(){
    return "<div title="{name}">Hello {name}</div>"
  }
}

OG.defineElement("hello-world",HelloWorld);
HTML
<hello-world></hello-world>

可变化

js
import OG from "originaljs";

class GoodsPrice extends OG.createElement(){
  render(){
    return `
    <button onclick="changePrice">Change</button>
    <div>{price}</div>
    `;
  }
  price=8.8;
  changePrice(){
    this.update("price",9.9);
  }
}

OG.defineElement("goods-price",HelloWorld);
HTML
<goods-price></goods-price>

Props

import OG from "originaljs";

class UserNickname extends OG.createElement(["nickname"]){
  render(){
    return `
    <div>{nickname}</div>
    `;
  }
  nickname="JavaScript";
}

OG.defineElement("user-nickname",HelloWorld);
HTML
<user-nickname nickname="Originaljs"></user-nickname>
0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.1

3 years ago