How to use the heyui/src/utils/utils.isArray function in heyui

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 / category / category.vue View on Github external
initCategoryDatas() {
      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.categoryDatas = this.initDatas(utils.copy(result));
            this.parse();
            this.globalloading = false;
            this.$emit('loadDataSuccess');
          },
          () => {
github heyui / heyui / src / components / select / select.vue View on Github external
parse() {
      if (this.multiple) {
        let values = this.value || [];
        if (!utils.isArray(values)) {
          console.warn(`[HeyUI WARNING] Select Component: value '${values}' can't be a value of a multiple select`);
          values = [];
        }
        this.codes = values.map((item) => {
          return this.type == 'key' ? this.getValue(item) : item[this.keyName];
        }).filter(item => item !== null);
      } else {
        if (this.type == 'key') {
          this.codes = this.getValue(this.value);
        } else {
          if (utils.isObject(this.value)) {
            this.codes = this.value[this.keyName];
          } else {
            this.codes = null;
          }
        }
github heyui / heyui / src / components / image-preview / imagepreview.vue View on Github external
computedList() {
      if (this.isSingle) {
        return [genObject(this.datas)];
      } else if (utils.isArray(this.datas)) {
        return this.datas.map(item => {
          return genObject(item);
        });
      }
      return [];
    }
  }
github heyui / heyui / src / components / category-picker / categorypicker.vue View on Github external
parse() {
      if (this.multiple) {
        let os = [];
        if (utils.isArray(this.value) && this.value.length > 0) {
          for (let v of this.value) {
            os.push(this.getValue(v));
          }
        }
        this.objects = os;
        this.object = null;
      } else {
        this.object = this.getValue(this.value);
        this.objects = [];
      }
    },
    getValue(item) {
github heyui / heyui / src / components / auto-complete / autocomplete.vue View on Github external
dispose() {
      let value = null;
      if (this.multiple) {
        value = [];
        if (utils.isArray(this.objects) && this.objects.length > 0) {
          for (let o of this.objects) {
            value.push(this.getV(o));
          }
        }
        return value;
      } else {
        if (this.mustMatch) {
          value = this.getV(this.object);
        } else {
          if (!utils.isBlank(this.object.key)) {
            value = this.getV(this.object);
          } else {
            if (!utils.isBlank(this.tempValue)) {
              let inputValue = null;
              if (this.type == 'title') {
                inputValue = this.tempValue;
github heyui / heyui / src / plugins / notify / index.js View on Github external
const that = this;
    this.mouseOver = false;
    this.closeTimeout = false;
    let param = this.param = utils.extend({}, Default, orignalparam, true);
    let html = '';
    if (param.hasMask) {
      html += `<div class="${notifyMaskCls}"></div>`;
    }
    if (param.type === TYPE.MODAL &amp;&amp; param.hasMask) {
      html += `<div class="${notifyBodyCls}">`;
    }
    html += `<div class="${notifyContainerCls}">`;
    if (param.hasCloseIcon) html += `<span class="${notifyCloseCls} ${closeIcon}"></span>`;
    if (param.title) html += `<header class="${param.type}-header">${param.title}</header>`;
    html += `<div class="${notifyContentCls}"></div>`;
    param.hasFooter = utils.isArray(param.buttons) &amp;&amp; param.buttons.length &gt; 0 &amp;&amp; !param.component;
    if (param.hasFooter) {
      let footeHtml = '';
      for (const b of param.buttons) {
        let name = '';
        let attr = '';
        let color = '';
        if (b == 'cancel') {
          name = b.name || locale.t('h.common.cancel');
          attr = b;
        } else if (b == 'ok') {
          name = b.name || locale.t('h.common.confirm');
          attr = 'ok';
          color = 'primary';
        } else if (utils.isObject(b)) {
          attr = b.type;
          name = b.name;</div></div>
github heyui / heyui / src / components / category / category.vue View on Github external
parse() {
      if (this.multiple) {
        let os = [];
        if (utils.isArray(this.value) && this.value.length > 0) {
          for (let v of this.value) {
            os.push(this.getValue(v));
          }
        }
        this.objects = os;
      } else {
        this.object = this.getValue(this.value);
      }
    },
    getValue(item) {
github heyui / heyui / src / components / table / table.vue View on Github external
setSelection(data) {
      if (utils.isArray(data)) {
        this.checks = [...data];
      }
    },
    getSelection() {
github heyui / heyui / src / components / cascader / cascader.vue View on Github external
parse() {
      if (this.multiple) {
        let os = [];
        if (utils.isArray(this.value) && this.value.length > 0) {
          for (let v of this.value) {
            os.push(this.getValue(v));
          }
        }
        this.objects = os;
      } else {
        this.object = this.getValue(this.value);
      }
    },
    getValue(item) {
github heyui / heyui / src / plugins / image-preview / image-preview-modal.vue View on Github external
computedDatas() {
      if (utils.isString(this.datas)) {
        return [this.datas];
      } else if (utils.isArray(this.datas)) {
        return this.datas;
      }
      return [];
    },
    isShowIndex() {