Comments (6)
See the form handling section: http://vuex.vuejs.org/en/forms.html
from vuex.
@airtonix can you post your exact solution with checkboxes/radio buttons please?
from vuex.
@yyx990803 that explains box fields (text/number/date/etc) form fields, but not select,radio or checkbox.
<label for="animalDogs">Dags</label>
<input type="radio"
id="animalDogs"
name="animal"
value="dogs"
:checked="animal === 'dogs'"
@change="setAnimal">
<select name="animal"
@change="setAnimal">
<option value="dogs"
:selected="animal === 'dogs'">Dags</option>
<option value="cats"
:selected="animal === 'cats'">Cats</option>
</select>
import store from 'app/store';
export default {
computed: {
animal () {
return store.state.animal;
}
},
methods: {
setAnimal: (type) {
store.actions.setAnimal(type);
}
}
}
Is this about right?
from vuex.
nevermind, using this instead:
#38
from vuex.
really, is there something up with checboxes and radio yet?
from vuex.
You can use https://github.com/yarsky-tgz/vuex-dot for full support of reactive changes on vuex. Checkboxes work too, sure )
Example of simple value changing through incrementing\decrementing:
<template>
<button @click.stop="step--">back</button>
<button @click.stop="step++">next</button>
</template>
<script>
import { takeState } from 'vuex-dot';
export default {
computed: {
step: takeState('wizard.step')
.commit('setWizardStep')
.map()
}
}
</script>
store/index.js
export default new Vuex.Store({
state: {
wizard: {
step: 1
}
},
mutations: {
setWizardStep(state, step) {
state.wizard.step = step;
}
}
});
from vuex.
Related Issues (20)
- vuex的例子报错
- Add useStore for v3 for vue 2.7 with composition api HOT 5
- Fix type definitions with `moduleResolutions` `nodenext` HOT 3
- The getter is updated, but the associated dom is not updated. HOT 8
- Mutation on nested properties
- vite 创建vue项目,安装vuex后vscode报错,Could not find a declaration file for module 'vuex'. HOT 7
- TypeError: Cannot read properties of undefined (reading 'state') at Proxy.mappedState (vuex.esm-bundler.js:1162:31) HOT 1
- Dynamic module not registered after hot reload
- vuex.esm-bundler.js is missing in the dist folder
- Error in Vuex document link HOT 2
- link pointing errors in docs HOT 1
- Memory increase: Update from 4.0.2 to 4.1.0 HOT 2
- A research for generating PR checklists in Pull Request Template HOT 1
- TypeError: Cannot read properties of undefined (reading '$store')
- Using `vuex` with the latest version of `vue` has a broken hot reload test HOT 1
- Is there way to exclude @vue/devtools-api code from final bundle?
- vuex3.6.2内存泄漏
- 使用mudule,在一个模块中commit另一个模块的mutations报unknown local mutation type
- Vuex Devtools plugins registered on server which increases memory usage
- 官网崩了
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuex.