How to use the heyui/src/utils/utils.copy 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-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 / components / category-picker / categorypicker.vue View on Github external
initDatas(datas) {
      let list = utils.copy(datas);
      if (this.param.dataMode == 'list' && datas.length > 0) {
        list = utils.generateTree(list, this.param);
      }
      let isWait = utils.isFunction(this.param.getDatas);
      this.categoryDatas = this.initTreeModeData(list, null, isWait, 0);
      this.list = this.categoryDatas;
      this.parse();
    },
    initTreeModeData(list, parentKey, isWait, level) {
github heyui / heyui / src / components / tree-picker / treepicker.vue View on Github external
this.$nextTick(() => {
          if (this.multiple) {
            this.objects = this.$refs.tree.getChoose();
          } else {
            this.object = this.$refs.tree.getSelect();
          }
        });
      } else {
        if (this.multiple) {
          this.valuebak = (this.value || []).map(
            item => item[this.param.keyName]
          );
          this.objects = utils.copy(this.value);
        } else {
          this.valuebak = this.value ? this.value[this.param.keyName] : null;
          this.object = utils.copy(this.value);
        }
      }
    },
    dispose() {
github heyui / heyui / src / components / taginput / taginput.vue View on Github external
add() {
      if (this.wordlimit < this.tagvalue.length) {
        Message.error(this.t('h.wordlimit.warn', [this.wordlimit]));
        return false;
      }
      if (this.limit <= this.values.length) {
        Message.error(this.t('h.taginput.limitWords'));
        return false;
      }
      if (this.readonly) return false;
      if (this.tagvalue === '') return false;
      let value = utils.copy(this.values);
      value.push(this.tagvalue);
      this.setvalue(value);
    },
    setvalue(value) {
github heyui / heyui / src / components / category / category.vue View on Github external
openPicker() {
      let that = this;
      if (this.disabled) return;
      Modal({
        width: 600,
        hasDivider: true,
        component: {
          vue: categoryModal,
          data: {
            param: this.param,
            objects: [...this.objects],
            object: utils.copy(this.object),
            categoryDatas: this.categoryDatas,
            categoryObj: this.categoryObj,
            multiple: this.multiple,
            limit: this.limit,
            filterable: this.filterable
          }
        },
        events: {
          setvalue(modal, data) {
            that.objects = data.objects;
            that.object = data.object;
            that.setvalue();
          },
          load: (modal, { data, callback }) => {
            if (data.status.loading) return;
            data.status.loading = true;
github heyui / heyui / src / components / taginput / taginput.vue View on Github external
remove(index) {
      if (this.readonly) return;
      let value = utils.copy(this.values);
      value.splice(index, 1);
      this.setvalue(value);
    },
    add() {