How to use the vue.nextTick function in vue

To help you get started, we’ve selected a few vue 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 dxe / adb / frontend / ActivistList.vue View on Github external
showModal(modalName: string, activist: Activist, index: number) {
      // Check to see if there's a modal open, and close it if so.
      if (this.currentModalName) {
        this.hideModal();
      }

      // Show the modal in the next tick so that this code runs after
      // vue has hidden the previous modal.
      Vue.nextTick(() => {
        this.currentActivist = activist;

        if (index != undefined) {
          this.activistIndex = index; // needed for updating activist
        } else {
          this.activistIndex = -1;
        }

        this.currentModalName = modalName;
        this.$modal.show(modalName);
      });
    },
    hideModal() {
github jdf2e / nutui / src / packages / cell / __test__ / cell.spec.js View on Github external
it('链接', () => {
        wrapper.setProps({ title: '测试title', subTitle: '测试subTitle', desc: '测试desc', showIcon: true, isLink: true, linkUrl:'http://m.jd.com' });

        return Vue.nextTick().then(function () {
            expect(wrapper.classes('nut-cell-link')).toBe(true);
            expect(wrapper.attributes('href')).toBe('http://m.jd.com');
        })
    });
});
github gitlabhq / gitlabhq / spec / frontend / registry / list / components / table_registry_spec.js View on Github external
it('selecting a row should enable delete button', done => {
      const deleteBtn = findDeleteButton();
      const checkboxes = findSelectCheckboxes();

      expect(deleteBtn.attributes('disabled')).toBe('disabled');

      checkboxes.at(0).trigger('click');
      Vue.nextTick(() => {
        expect(deleteBtn.attributes('disabled')).toEqual(undefined);
        done();
      });
    });
github gitlabhq / gitlabhq / spec / javascripts / boards / issue_card_spec.js View on Github external
it('does not render label if label does not have an ID', done => {
      component.issue.addLabel(
        new ListLabel({
          title: 'closed',
        }),
      );

      Vue.nextTick()
        .then(() => {
          expect(component.$el.querySelectorAll('.badge').length).toBe(2);
          expect(component.$el.textContent).not.toContain('closed');

          done();
        })
        .catch(done.fail);
    });
  });
github ruiyong-lee / weapp-vue-eggjs-shop-demo / pc_vue / src / store.js View on Github external
refreshPage({ commit }, routeName) {
      commit('setRefreshPageMap', { key: routeName, value: true });
      Vue.nextTick(() => {
        commit('setRefreshPageMap', { key: routeName, value: false });
      });
    },
  },
github yunity / karrot-frontend / src / base / datastore / routerPlugin.spec.js View on Github external
it('calls parent enter action first and leave action last', async () => {
    const callOrder = []
    test.actions.beforeEnter.mockImplementationOnce(() => callOrder.push('parentEnter'))
    test.actions.beforeEnterChild.mockImplementationOnce(() => callOrder.push('childEnter'))
    test.actions.afterLeave.mockImplementationOnce(() => callOrder.push('parentLeave'))
    test.actions.afterLeaveChild.mockImplementationOnce(() => callOrder.push('childLeave'))
    router.push({ name: 'child', params: { testId: '42', childId: '44' } })
    await Vue.nextTick(); await Vue.nextTick()
    router.push({ name: 'route2' })
    await Vue.nextTick()
    expect(test.actions.beforeEnter.mock.calls[0][1]).toHaveProperty('testId', 42)
    expect(test.actions.beforeEnter.mock.calls[0][1]).toHaveProperty('childId', 44)
    expect(test.actions.beforeEnterChild.mock.calls[0][1]).toHaveProperty('testId', 42)
    expect(test.actions.beforeEnterChild.mock.calls[0][1]).toHaveProperty('childId', 44)
    expect(callOrder).toEqual(['parentEnter', 'childEnter', 'childLeave', 'parentLeave'])
  })
})
github swisnl / laravel-nova-mirror / resources / js / components / SearchInput.vue View on Github external
chooseSelected() {
            if (this.data[this.selected] !== undefined) {
                this.$emit('selected', this.data[this.selected])
                this.$refs.input.focus()
                Vue.nextTick(() => this.close())
            }
        },
github n8n-io / n8n / packages / editor-ui / src / components / TextEdit.vue View on Github external
dialogVisible () {
			if (this.dialogVisible === true) {
				Vue.nextTick(() => {
					(this.$refs.inputField as HTMLInputElement).focus();
				});
			}
		},
	},
github ElemeFE / element / packages / table / src / table-layout.js View on Github external
setHeight(value, prop = 'height') {
    if (Vue.prototype.$isServer) return;
    const el = this.table.$el;
    value = parseHeight(value);
    this.height = value;

    if (!el && (value || value === 0)) return Vue.nextTick(() => this.setHeight(value, prop));

    if (typeof value === 'number') {
      el.style[prop] = value + 'px';
      this.updateElsHeight();
    } else if (typeof value === 'string') {
      el.style[prop] = value;
      this.updateElsHeight();
    }
  }
github gitlabhq / gitlabhq / spec / javascripts / notes / components / note_app_spec.js View on Github external
setTimeout(() => {
          vm.$el.querySelector('.js-note-edit').click();
          Vue.nextTick(done);
        }, 0);
      });