How to use the omi.Component function in omi

To help you get started, we’ve selected a few omi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tencent / omi / plugins / omi-jquery-date-picker / example / simple / main.js View on Github external
import Omi from 'omi';
import OmiJQueryDatePicker from '../../omi-jquery-date-picker.js';

OmiJQueryDatePicker.init();

class App extends Omi.Component {
    constructor(data) {
        super(data);
        this.data.date = '';
    }

    applyHandle(evt, obj){
        console.log('apply', obj);
        console.log(this.datePicker);
        this.data.date = this.refs.dateInput.value;
    }

    render() {
        return  `
        <div>
            <input value="${this.data.date}" size="40">
        </div>
github Tencent / omi / docs / old-bak / src / component / pager / index.js View on Github external
import Omi from 'omi';
import config from '../../docs/config.js';
import OmiFinger from 'omi-finger';

OmiFinger.init();

class Pager extends Omi.Component {
    constructor (data) {
        super(data);
        this.activeIndex = 0;
        this.currentIndex = 0;
    }

    updatePager() {
        this.data.preMd = null;
        this.data.preName = null;
        this.data.nextMd = null;
        this.data.nextName = null;
        let item = config.menus[this.data.lan][this.activeIndex];

        let pre = item.list[this.currentIndex - 1];
        if (pre) {
            this.data.preMd = pre.md;
github Tencent / omi / example / old-bak / qq-nearby / src / component / user_list / index.js View on Github external
import Omi from 'omi'

class UserList extends Omi.Component {
    constructor(data) {
        super(data)
    }

    install() {
        this.data.uin_info || (this.data.uin_info = [])
        this.data.uin_info.forEach(user => {
            this.prepareData(user)
        })
        this.done = false
    }

    prepareData(user){
        user.desc_d = user.desc.split("&nbsp;")[0]
        user.desc_t = user.desc.split("&nbsp;")[1]
        user.isBoy = user.sex === "男"
github dntzhang / qone / plugins / omi-router / example / simple / about.js View on Github external
import Omi from 'omi'

class About extends Omi.Component {
    render() {
        return  <div>About</div>
    }
}

Omi.tag('about',About)

export default  About
github Tencent / omi / scaffolding / src / js / index.js View on Github external
import Root from './config.js';
import Omi from 'omi';

import Header from '../component/header/index.js';
import Footer from '../component/footer/index.js';

Omi.tag('header', Header);
Omi.tag('footer', Footer);

class Main extends Omi.Component {
    constructor (data) {
        super(data);
    }

    style () {
        return `
        .main{
            position:fixed;
            height:45px;
            line-height: 145px;
            text-align:center;
            width:100%;
            background-color:blue;
            z-index:100;
        }
        `;
github Tencent / omi / docs / old-bak / src / component / list / index.js View on Github external
import Omi from 'omi';

const tpl = require('./index.html');
const css = require('./index.css');

class List extends Omi.Component {
    constructor(data) {
        super(data);
        Omi.mixIndexToArray(this.data.list);
        this.data.currentIndex = 0;
        var self = this;
        this.data.isCurrent = function () {
            return (this.index === self.data.currentIndex) && self.data.active;
        }
    }

    goto(name, index) {

        Omi.get('content').data.name = name;
        Omi.get('content').update();
        this.data.currentIndex = index;
        this.parent.children.forEach((child,index) => {
github dntzhang / qone / plugins / omi-router / example / simple / home.js View on Github external
import Omi from 'omi'

class Home extends Omi.Component {
    render() {

      	return <div>Home</div>

    }
}

Omi.tag('home',Home)

export default  Home
github Tencent / omi / example / old-bak / qq-nearby / src / js / index.js View on Github external
import Root from './config.js'
import Omi from 'omi'
import UserList from '../component/user_list/index.js'

Omi.makeHTML('UserList', UserList)

class Main extends Omi.Component {
    constructor(data) {
        super(data)
    }

    installed() {
        window.onscroll = () =&gt; this.loadMore()
        this.requestData(data =&gt; this.list.appendUsers(data))
    }

    loadMore() {
        const body = document.body,
            html = document.documentElement,
            height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight),
            vp_height = window.innerHeight

        if (height - document.body.scrollTop - vp_height &lt; 200) {
github Tencent / omi / md2site / template / app / src / component / sidebar.js View on Github external
import Omi from 'omi';
import List from './list/index.js';
import config from '../docs/config.js';

Omi.makeHTML('List', List);

class Sidebar extends Omi.Component {
    constructor(data) {
        super(data);
    }

    install () {
        this.data.items = config['menus'][this.data.lan] ;
        this.data.height = window.innerHeight -45;
    }

    style () {
        return `
    <style>
        @media only screen and (max-width: 768px) {
            .list{
                transform: translateX(-100%);
                background-color:white;</style>
github Tencent / omi / pr / example / spa / src / user-list.js View on Github external
import Omi from 'omi';

class UserList extends Omi.Component {

    render() {
        return  `
      	 <ul>
      	    <li><a>yanagao</a></li>
            <li><a>vorshen</a></li>
            <li><a>dntzhang</a></li>
        </ul>
  		`;
    }
}


Omi.tag('UserList',UserList)

export default  UserList

omi

<p align="center"><img src="https://omijs.github.io/home/assets/logo.svg" alt="omi" width="100"/></p> <h2 align="center">Omi - Web Components Framework</h2>

MIT
Latest version published 2 months ago

Package Health Score

79 / 100
Full package analysis