Skip to main content

2 posts tagged with "vuejs"

View All Tags

· One min read
Hreniuc Cristian-Alexandru

Installl nvm

# Check latest release: https://github.com/nvm-sh/nvm/releases/latest
# This commands also adds the paths to your ~/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc

Install latested node version and use it

nvm install --lts
nvm use --lts
# Or
nvm use 16.15.0

Install yarn and upgrade npm:

npm install --global yarn

npm install -g [email protected]

Install RESTer extension.

· One min read
Hreniuc Cristian-Alexandru

LE: 14th Sept 2022 - Use Vue3 and you no longer need actions and mutations. Use State Management with Reactivity API

1. When you want to commit to a state(using actions and mutations), do not pass multiple parameters to the commit method, they will have the value undefined. Create an object and pass it like that. This:

commit(types.UPDATE_JOB, index, title);

Will become this:

commit(types.UPDATE_JOB, {index: index, title: job.title});

2. Props that have default value:

export default {
props: {
prop_without_defaut_value: {},
prop_with_defaut_value: {
default: false // this is a bool value
},
prop_with_defaut_value_string: {
default: String
}
},
data() {
return {
var_name: false
}
}
}

3. Use mapActions and custom methods:

methods: Object.assign({},
/* If we want to use mapActions and other
custom methods this is the way to do it
otherwise it will give an error */
mapActions([
'action_1',
'action_2'
]), {
method_1() {
this.title = this.job.title;
this.edit_mode = !this.edit_mode;
},
method_2() {}
}
),