1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Son2.vue 804 Bytes
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-17 14:52 +08:00 . Vueinit
<template>
<div>
<h2>son2</h2>
<p>标题</p>
<input type='text' v-model="title"/>
<p>内容</p>
<input type='text' v-model='content'/>
<br>
<el-button @click="add()">提交</el-button>
</div>
</template>
<style scoped>
</style>
<script>
import store from '@/store' //引入store存储 (vuex)
export default {
store,
//data(){}里要 return{}
data(){
return {
title: '',
content: '',
}
},
methods:{
add(){
store.commit('addItems',{ title1: this.title,content1: this.content}) //调用store的方法 value传参
this.title='';
this.content='';
this.$router.push('/Hellocopy/Son1');
}
}
}
</script>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助