How to use heyui - 10 common examples

To help you get started, we’ve selected a few heyui 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 heyui / heyui / src / components / menu / menu.vue View on Github external
trigger(data) {
      if (data.type == 'togglemenuEvent') {
        let menu = data.data;
        this.status.opened = utils.toggleValue(this.status.opened, menu.key);

        // accordion
        if (this.accordion && this.status.opened.indexOf(menu.key) > -1) {
          for (let key in this.menuobj) {
            let mo = this.menuobj[key];
            if (mo.parent === menu.parent && menu.key != key && this.status.opened.indexOf(mo.key) > -1) {
              this.status.opened.splice(this.status.opened.indexOf(mo.key), 1);
            }
          }
        }

        this.$emit('click', menu);
        let isParent = menu.children && menu.children.length > 0;
        if (isParent && (!this.activeAll || this.status.selected == menu.key)) {
          return;
        }
github heyui / heyui / src / components / date-picker / datepicker.vue View on Github external
import Dropdown from 'heyui/src/plugins/dropdown';
import dateBase from 'heyui/src/components/date-picker/datebase';
import Locale from 'heyui/src/mixins/locale';

const prefix = 'h-datetime';

const manbaType = {
  year: manba.YEAR,
  month: manba.MONTH,
  date: manba.DAY,
  datetime: manba.MINUTE,
  time: manba.MINUTE,
  datehour: manba.HOUR
};

const options = config.getOption('datepicker');

export default {
  name: 'hDatePicker',
  mixins: [Locale],
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    readonly: {
      type: Boolean,
      default: false
    },
    type: {
      type: [String],
      default: 'date' // year, month, week
github heyui / heyui / src / plugins / validator / validation / typeValids.js View on Github external
message() {
      return locale.t('h.validation.type.globalmobile');
    }
  } // international mobile
github heyui / heyui / src / components / cell / cell.vue View on Github external
classes() {
      let width = this.width;
      let classList = [`${prefixCls}`];
      classList.push({
        [`${prefixCls}-${width}`]: width,
        [`${this.className}`]: !!this.className
      });

      // let noOtherWidth = width==undefined&&this.flex == undefined;
      let lastSize = null;
      for (let size of [ 'xl', 'lg', 'md', 'sm', 'xs' ]) {
        if (utils.isNumber(this[size])) {
          lastSize = this[size];
          classList.push(`${prefixCls}-${size}-${this[size]}`);
        } else if (lastSize) {
          classList.push(`${prefixCls}-${size}-${lastSize}`);
        }
      }

      return classList;
    },
    styles() {
github heyui / heyui / src / components / pagination / pagination.vue View on Github external
jump(event) {
      let value = parseInt(event.target.value, 10);
      // log(value);
      if (isNaN(value)) {
        Message.error(this.t('h.pagination.incorrectFormat'));
        return;
      }
      if (value > this.count || value < 1) {
        Message.error(this.t('h.pagination.overSize'));
        return;
      }
      let cur = parseInt(event.target.value, 10);
      if (cur == (this.value.page || this.cur)) {
        return;
      }
      this.setvalue({ cur: cur, size: this.sizeNow });
    },
    change(cur) {
github heyui / heyui / src / components / category-picker / categorypicker.vue View on Github external
setvalue(trigger) {
      let value = this.dispose();
      this.$emit('input', value);
      this.$emit('change', utils.copy(this.multiple ? this.objects : this.object));
      if (trigger != 'clear') {
        this.valueBak = value;
      }
      let event = document.createEvent('CustomEvent');
      event.initCustomEvent('setvalue', true, true, value);
      this.$el.dispatchEvent(event);
      this.dropdownUpdate();
    },
    initCategoryDatas() {
github heyui / heyui / src / components / tree-picker / treepicker.vue View on Github external
this.$nextTick(() => {
        this.$emit(
          'change',
          utils.copy(this.multiple ? this.objects : this.object)
        );
      });
    },
github heyui / heyui / src / components / cascader / cascader.vue View on Github external
setvalue() {
      let value = this.dispose();
      this.$emit('input', value);
      this.$emit('change', utils.copy(this.multiple ? this.objects : this.object));
      let event = document.createEvent('CustomEvent');
      event.initCustomEvent('setvalue', true, true, value);
      this.$el.dispatchEvent(event);
    },
    initCascaderDatas() {
github heyui / heyui / src / plugins / pop / index.js View on Github external
constructor(reference, options) {
    options = utils.extend({}, DEFAULT_OPTIONS, options);
    this.reference = reference;

    this.options = options;

    const triggerEvents = typeof options.trigger === 'string' ? options.trigger.split(' ').filter((trigger) => {
      return ['click', 'hover', 'focus', 'manual', 'contextMenu'].indexOf(trigger) !== -1;
    }) : [];

    this.isOpen = false;

    this.arrowSelector = options.arrowSelector;
    this.innerSelector = options.innerSelector;
    this.triggerEvents = [];
    if (options.content.nodeType === 1) {
      options.content.style.display = 'none';
    }
github heyui / heyui / src / components / cascader / cascader.vue View on Github external
initCascaderDatas() {
      let datas = [];
      if (utils.isArray(this.param.datas)) {
        datas = this.param.datas;
      } else if (utils.isFunction(this.param.datas)) {
        datas = this.param.datas.apply(this.param);
      }
      if (utils.isFunction(this.param.getTotalDatas) || utils.isFunction(this.param.getDatas)) {
        datas = [];
        this.globalloading = true;
        let loadData = this.param.getTotalDatas || this.param.getDatas;
        let param = [
          result => {
            this.cascaderDatas = this.initDatas(utils.copy(result));
            this.parse();
            this.globalloading = false;
            this.$emit('loadDataSuccess');
          },
          () => {
            this.globalloading = false;
          }
        ];
        if (this.param.getDatas) {
          param.unshift(null);