New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

omi

Package Overview
Dependencies
Maintainers
1
Versions
373
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

omi

Omi is Omi.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
595
decreased by-30.65%
Maintainers
1
Weekly downloads
 
Created
Source

Omi

Open and modern framework for building user interfaces.


Omi

通过npm安装

npm install omi

Hello World

class Hello extends Omi.Component {
    constructor(data) {
        super(data);
    }
    style () {
        return  `
            h1{
                cursor:pointer;
            }
         `;
    }
    handleClick(target, evt){
        alert(target.innerHTML);
    }
    render() {
        return  `
        <div>
            <h1 onclick="handleClick(this, event)">Hello ,{{name}}!</h1>
        </div>
        `;

    }
}

Omi.render(new Hello({ name : "Omi" }),"body");

[点击这里->在线试试]

你可以使用Omi.makeHTML来生成组件标签用于嵌套。

    Omi.makeHTML('Hello', Hello);

那么你就在其他组件中使用,并且通过data-*的方式可以给组件传参,如:

  ...
  render() {
        return  `
        <div>
            <div>Test</div>
            <Hello data-name="Omi" />
        </div>
        `;
    }
    ...

[点击这里->在线试试]

你可以使用 webpack + babel,在webpack配置的module设置babel-loader,立马就能使用ES6+来编写你的web程序。

当然Omi没有抛弃ES5的用户,你可以使用ES5的方式编写Omi。[点击这里试试ES5写Omi程序]

License

This content is released under the MIT License.

Keywords

FAQs

Package last updated on 05 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc