How to use the omi.render 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.

github Tencent / omi / packages / omim / demos / list-old / index.js View on Github external
<item>Divider+Inset:</item>
        <item divider inset></item>
        <item>Divider+Padded+Inset:</item>
        <item divider padded inset></item>
        <item disabled>Disabled</item>
        <item selected>Selected</item>
        <item activated>Activated</item>
        <item graphic={<m-icon-button icon='folder'></m-icon-button>}>Graphic</item>
        <item text='Text'></item>
        <item primary-text='Primary Text' secondary-text='Secondary Text'></item>
        <item text='Meta' meta={<m-icon-button icon='folder'></m-icon-button>}></item>
      </m-list>
    </div>
  }
})
render(<my-app />, 'body')
github Tencent / omi / packages / omi-mp / src / utils / mp.js View on Github external
//set twice
      setTimeout(function () {
        document.documentElement.scrollTop = ele._preScrollTop
        document.body.scrollTop = ele._preScrollTop
      }, 0)
    } else {
      const node = render(vnode, root)
      node.onShow && node.onShow()
      wx.currentPage = node
      document.documentElement.scrollTop = 0
      document.body.scrollTop = 0
    }
  } else {
    const ele = document.querySelector(selector)
    ele && ele.parentNode.removeChild(ele)
    const node = render(vnode, root)
    node.onShow && node.onShow()
    wx.currentPage = node
    document.documentElement.scrollTop = 0
    document.body.scrollTop = 0
  }
}
github Tencent / omi / packages / cax-omip / src / libs / router / index.js View on Github external
}, 0)
    } else {
      const node = render(vnode, root)
      node.onShow && node.onShow()
      node._component && node._component.onShow && node._component.onShow()
      currentPage = node
      document.documentElement.scrollTop = 0
      document.body.scrollTop = 0
    }
  } else {
    //前进
    if (item && item.ele) {
      item.ele.parentNode.removeChild(item.ele)
      remove(item)
    }
    const node = render(vnode, root)
    node.onShow && node.onShow()
    node._component && node._component.onShow && node._component.onShow()
    currentPage = node

    const ele = root.childNodes[root.childNodes.length - 1]
    stackList.push({ slt: selector, ele: ele, display: window.getComputedStyle(ele).display, scrollTop: 0 })
    document.documentElement.scrollTop = 0
    document.body.scrollTop = 0
  }
}
github Tencent / omi / packages / omim / demos / badge / index.js View on Github external
import '../../src/badge/index.tsx'
import '../../src/icon/index.tsx'
import '../../src/icon-button/index.tsx'
import { render, h } from 'omi'

render(
  <div>
    <m-badge content={8}>
      <m-icon path="M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z" color="#07C160" />
    </m-badge>

    <br /><br /><br />
    <m-badge content={99}>
      <m-icon path="M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z" color="red" />
    </m-badge>

    <br /><br /><br />

    <m-badge content="new">
      <m-icon path="M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z" color="black" />
    </m-badge>
github Tencent / omi / packages / omip / my-app / src / libs / router / index.js View on Github external
//浏览器后退
    if (item && item.ele) {
      const ele = item.ele
      ele.style.display = item.display
      ele.onShow && ele.onShow()
      ele._component && ele._component.onShow && ele._component.onShow()
      currentPage = ele
      document.documentElement.scrollTop = item.scrollTop
      document.body.scrollTop = item.scrollTop
      //set twice
      setTimeout(function () {
        document.documentElement.scrollTop = item.scrollTop
        document.body.scrollTop = item.scrollTop
      }, 0)
    } else {
      const node = render(vnode, root)
      node.onShow && node.onShow()
      node._component && node._component.onShow && node._component.onShow()
      currentPage = node
      document.documentElement.scrollTop = 0
      document.body.scrollTop = 0
    }
  } else {
    //前进
    if (item && item.ele) {
      item.ele.parentNode.removeChild(item.ele)
      remove(item)
    }
    const node = render(vnode, root)
    node.onShow && node.onShow()
    node._component && node._component.onShow && node._component.onShow()
    currentPage = node
github Tencent / omi / packages / omim / demos / color-picker / index.js View on Github external
import '../../src/color-picker/index.tsx'
import { render, h } from 'omi'

render(
  <div>
   <m-color-picker strings={{save:'保存'}} width="300px"></m-color-picker>
   <div>abc</div>
  </div>
  , 'body')
github Tencent / omi / packages / omim / demos / drawer / index.js View on Github external
background:#fff;
       
      }`}
            items={this.items}

            onItemClick={this.onItemClick}
          ></m-list>


        </m-drawer>
      </div>
    )
  }
})

render(<my-app />, 'body')
github Tencent / omi / packages / omi-page / examples / simple / main.js View on Github external
this.data.path = ctx.path
        this.update()
    }

    contact = (ctx) => {
        this.data.path = ctx.path
        this.update()
    }

    notfound = (ctx) => {
        this.data.path = ctx.path
        this.update()
    }
}

render(<my-app></my-app>, 'body')
github Tencent / omi / packages / omi-cli / template / weui / src / index.js View on Github external
import { render } from 'omi'
import './assets/index.css'
import './elements/app'

import store from './store/app-store'

render(<my-app />, '#root', store)
github Tencent / omi / packages / omim / demos / scroll / index.js View on Github external
<li>Pretty row 49</li>
              <li>Pretty row 50</li>
            </ul>
          </div>
        </div>

      </m-scroll>

      <div id="footer"></div>
    </div>

  }
})


render(<my-app />, 'body')