vue 使用记录
vue 使用记录
1.路径:http://localhost:8081/#/test?name=1<router-link:to="{path:'/test',query:{name:id}}">跳转</router-link>(id是参数)使用:this.$route.query.id
2.路径:http://localhost:8081/#/test/1<router-link:to="'/test/'+id">跳转</router-link>(id是参数){path:'/test/:id',name:'Test',component:require('./component/Test.vue')}使用:this.$route.params.idthis.$route是一个数组,里面包含路由的所有信息注意:router-link中链接如果是‘/’开始就是从根路由开始,如果开始不带‘/’,则从当前路由开始3.##vue删除一行数据<buttonv-on:click="doM(id,index)"></button>data:{todos:[{},{}]}methods:{doM:function(id,index){this.todos.splice(index,1)}}4.在option选择框中,value要绑定属性,@bind:valueor:value1<selectv-model='somedata.gid'class="form-control"><optionvalue='default'>请选择类别...</option><templatev-for="dinthis.listdata"><optionv-if="somedata.gid==d.gidNumber":value='somedata.gid'selected>{{d.cn}} 组</option><optionv-else:value='d.gidNumber'>{{d.cn}} 组</option></template></select>
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。