How to use the vue.set 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 n8n-io / n8n / packages / editor-ui / src / components / NodeSettings.vue View on Github external
lastNamePart = lastNameParts[2];
						isArray = true;
					}
				}

				// Set the value via Vue.set that everything updates correctly in the UI
				if (nameParts.length === 0) {
					// Data is on top level
					if (value === null) {
						// Property should be deleted
						// @ts-ignore
						Vue.delete(this.nodeValues, lastNamePart);
					} else {
						// Value should be set
						// @ts-ignore
						Vue.set(this.nodeValues, lastNamePart, value);
					}
				} else {
					// Data is on lower level
					if (value === null) {
						// Property should be deleted
						// @ts-ignore
						let tempValue = get(this.nodeValues, nameParts.join('.')) as INodeParameters | NodeParameters[];
						Vue.delete(tempValue as object, lastNamePart as string);

						if (isArray === true && (tempValue as INodeParameters[]).length === 0) {
							// If a value from an array got delete and no values are left
							// delete also the parent
							lastNamePart = nameParts.pop();
							tempValue = get(this.nodeValues, nameParts.join('.')) as INodeParameters;
							Vue.delete(tempValue as object, lastNamePart as string);
						}
github Alethio / ethereum-lite-explorer / src / components / TxSidebarNav.vue View on Github external
context.lib_getTransaction(block.transactions[i], true, (terr, ttx) => {
                if (uid === context.tx_uid) { // safeguard as we are not synchronous
                  if (ttx.value_eth > context.maximum) {
                    context.maximum = ttx.value_eth;
                  }
                  Vue.set(context.transactions[ttx.transactionIndex], 'value', ttx.value_eth);
                }
              });
            }
github peterq / pan-light / demo / demo-online-front / src / app.js View on Github external
evt: 'join',
            sessionId
        }])
        room.members = room.members.concat([sessionId])
    })
    room.onRemote('room.member.remove', sessionId => {
        room.members = room.members.filter(id => id !== sessionId)
        room.messages = room.messages.concat([{
            id: +new Date,
            type: 'system',
            evt: 'leave',
            sessionId
        }])
    })
    room.onRemote('broadcast.user', data => roomHandleUserBroadCast(room, data))
    Vue.set($state.roomMap, room.name, room)
    // 全员群
    if (room.name === 'room.all.user') {
        room.onRemote('ticket.turn', data => roomHandleUserTicketTurn(room, data))
    }

    // slave 全员群
    if (room.name.indexOf('room.slave.all.user') === 0) {
        room.onRemote('slave.exit', data => {
            if (data.unexpected) {
                $state.$alert('demo 进程意外结束', 'Whoops', {type: 'error'})
            } else {
                $state.$message.info('体验结束')
            }
            $state.connectVnc = null
        })
github gitlabhq / gitlabhq / ee / app / assets / javascripts / vue_shared / security_reports / store / mutations.js View on Github external
[types.SET_ISSUE_MODAL_DATA](state, payload) {
    const { issue, status } = payload;

    Vue.set(state.modal, 'title', issue.title);
    Vue.set(state.modal.data.description, 'value', issue.description);
    Vue.set(state.modal.data.file, 'value', issue.location && issue.location.file);
    Vue.set(state.modal.data.file, 'url', issue.urlPath);
    Vue.set(state.modal.data.className, 'value', issue.location && issue.location.class);
    Vue.set(state.modal.data.methodName, 'value', issue.location && issue.location.method);
    Vue.set(state.modal.data.namespace, 'value', issue.namespace);

    if (issue.identifiers && issue.identifiers.length > 0) {
      Vue.set(state.modal.data.identifiers, 'value', issue.identifiers);
    } else {
      // Force a null value for identifiers to avoid showing an empty array
      Vue.set(state.modal.data.identifiers, 'value', null);
    }

    Vue.set(state.modal.data.severity, 'value', issue.severity);
    Vue.set(state.modal.data.confidence, 'value', issue.confidence);
    Vue.set(state.modal.data.solution, 'value', issue.solution);

    if (issue.links && issue.links.length > 0) {
      Vue.set(state.modal.data.links, 'value', issue.links);
    } else {
github briancaffey / django-postgres-vue-gitlab-ecs / quasar / src / store / user / index.js View on Github external
[USER_SUCCESS]: (s, resp) => {
    // s.status = "success";
    Vue.set(state, "profile", resp);
  },
  [USER_ERROR]: s => {
github AlbertLucianto / vuex-search / web / store / mutations.js View on Github external
[mutationTypes.SET_GENERATING](state, { generating }) {
    Vue.set(state.resources, 'generating', generating);
  },
};
github yunity / karrot-frontend / src / store / modules / history.js View on Github external
        .forEach(([prop, value]) => Vue.set(state, prop, value))
    },
github handsontable / vue-handsontable-official / docs / demo / src / sampleApp.vue View on Github external
toggle: function(input, property, onValue, offValue) {
        if (onValue === void 0) {
          onValue = true;
        }
        if (offValue === void 0) {
          offValue = false;
        }


        if (input.checked) {
          Vue.set(this.hotSettings, property, onValue);

        } else {
          Vue.set(this.hotSettings, property, offValue);
        }
      },
      toggleOption: function(event) {
github nicklaw5 / stryve / src / vuex / servers / store.js View on Github external
[types.GENERATE_NEW_SERVER_INVITATION_SUCCESS] (store, invitation) {
		set(state, 'serverInvitivationToken', invitation.invitation_token)
	},
github nicklaw5 / stryve / src / vuex / contacts / store.js View on Github external
[types.RESET_CONTACTS] (state) {
		set(state, 'searching', false)
		set(state, 'currentContact', null)
		set(state, 'pinnedContacts', {})
		set(state, 'searchContacts', {})
	},