How to use the yox function in yox

To help you get started, we’ve selected a few yox 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 divawth / bell-ui / src / component / notification / index.ts View on Github external
function addNotification(status: string,  data: Data, onClose?: Function) {

  let props: Data = { status }

  // 先写 config,可支持 data 覆盖全局配置
  Yox.object.extend(props, config)

  if (Yox.is.string(data)) {
    props.content = data
  }
  else {
    Yox.object.extend(props, data)
  }

  const instance: any = new Yox(
    Yox.object.extend(
      {
        el: '#${prefix}notification-wrapper',
        props,
      },
      Notification
    )
  )

  instance.on('hide.notification', function () {
    if (onClose) {
      onClose()
    }
    instance.destroy()
  })
github divawth / bell-ui / dist / components / message / base.js View on Github external
var createMessage = function (data) {
    var namespace = '${prefix}message-' + id++;
    var element = Yox.dom.createElement('div');
    Yox.dom.prop(element, 'id', namespace);
    Yox.dom.append(document.body, element);
    var instance = new Yox({
        el: '#' + namespace,
        replace: TRUE,
        template: template,
        props: {
            content: data.content,
            type: data.type,
            showIcon: data.showIcon,
            closable: data.closable,
            closeText: data.closeText,
            center: data.center
        },
        propTypes: {
            content: {
                type: RAW_STRING
            },
            type: {
github divawth / bell-ui / dist / components / notice / base.js View on Github external
var createNotice = function (data) {
    var namespace = '${prefix}notice-' + id++;
    var body = Yox.dom.find('#${prefix}notice-wrapper');
    var element = Yox.dom.createElement('div');
    Yox.dom.prop(element, 'id', namespace);
    Yox.dom.append(body, element);
    var instance = new Yox({
        el: '#' + namespace,
        replace: TRUE,
        template: template,
        props: {
            title: data.title,
            content: data.content,
            type: data.type,
            duration: data.duration,
            width: data.width,
            right: data.right,
            onClose: data.onClose
        },
        propTypes: {
            title: {
                type: RAW_STRING,
                value: '温馨提示'
github divawth / bell-ui / dist / components / msgbox / base.js View on Github external
var createAlert = function (data) {
    var namespace = '${prefix}msg-alert-' + id++;
    var body = Yox.dom.find('#${prefix}msgbox-wrapper');
    var element = Yox.dom.createElement('div');
    Yox.dom.prop(element, 'id', namespace);
    Yox.dom.append(body, element);
    var instance = new Yox({
        el: '#' + namespace,
        replace: true,
        template: MsgboxTpl,
        props: {
            title: data.title,
            closable: data.closable,
            content: data.content || data,
            button: data.button,
            maskClosable: data.maskClosable,
            onClose: data.onClose,
            width: data.width,
            mask: data.mask
        },
        propTypes: {
            title: {
                type: RAW_STRING,
github divawth / bell-ui / src / component / message / index.ts View on Github external
function addMessage(status: string, arg: Arg, onClose?: Function) {

  const props: Data = { status }

  Yox.object.extend(props, config)

  if (Yox.is.string(arg)) {
    props.content = arg as string
  }
  else {
    Yox.object.extend(props, arg as Data)
  }

  const instance: any = new Yox(
    Yox.object.extend(
      {
        el: BODY,
        props,
      },
      Message
    )
  )

  instance.on('hide.message', function () {
    if (onClose) {
      onClose()
    }
    instance.destroy()
  })
github divawth / bell-ui / src / component / loading-bar / index.ts View on Github external
function add(props: Config | void) {

  const wrapper = Yox.dom.find('#${prefix}loadingbar-wrapper') as HTMLElement

  instance = new Yox(
    Yox.object.extend(
      {
        el: wrapper,
        props,
      },
      LoadingBar
    )
  )

  return instance

}
github divawth / bell-ui / dist / components / msgbox / base.js View on Github external
var createConfirm = function (data) {
    var namespace = '${prefix}msg-confirm-' + id++;
    var body = Yox.dom.find('#${prefix}msgbox-wrapper');
    var element = Yox.dom.createElement('div');
    Yox.dom.prop(element, 'id', namespace);
    Yox.dom.append(body, element);
    var instance = new Yox({
        el: '#' + namespace,
        replace: TRUE,
        template: ConfirmTpl,
        props: {
            title: data.title || data,
            closable: data.closable,
            content: data.content || data,
            buttons: data.buttons,
            maskClosable: data.maskClosable,
            onClose: data.onClose,
            mask: data.mask,
            width: data.width
        },
        propTypes: {
            title: {
                type: RAW_STRING,

yox

A lightweight mvvm framework

MIT
Latest version published 1 year ago

Package Health Score

49 / 100
Full package analysis