javascript - vuejs 利用ajax与后台进行交互
问题描述
<p data-page='conversation' id='conversation'>
<p class='conversation'><p class='conversation_title'>{{memcon}}</p><span class='conversation_obj'> <span>任务执行人:</span> <span v-for='peopl in people'>{{peopl}} </span><br /> <span>谈话对象:</span> <span>{{peopleObj}}</span></span><br /><span>谈话时间:</span><span class='conversation_time'>{{memconTime}}</span> </p> <p class='conversation_content'>{{content}}</p> <p class='conversation_img'><span v-if='imgs.length>0' v-for='img in imgs'> <img :src='https://www.haobala.com/wenda/img' alt='' /></span> </p> <p class='comment'><textarea rows='3' placeholder='添加文字点评. . . '></textarea><button>提交</button> </p> <hr /> <p class='mission_read'><span class='left'>已读</span><span class='right'><span>{{peoples}}</span>人</span><p class='clear'></p><span v-for='(portrai,index) in portrait'> <img :src='https://www.haobala.com/wenda/portrai' alt='' /> <span>{{nickname[index]}}</span></span> </p></p>
module.exports = {
data:function(){return{ memcon:’第二次谈话’, memconTime:’2017-06-10’, content:’城乡社区是社会治理的基本单元。城乡社区治理事关党和国家大政方针贯彻落实,事关居民群众切身利益,事关城乡基层和谐稳定。为实现党领导下的政府治理和社会调节、居民自治良性互动,全面提升城乡社区治理法治化、科学化、精细化水平和组织化程度,促进城乡社区治理体系和治理能力现代化,现就加强和完善城乡社区治理提出以下意见。’, imgs:[’../src/imgs/user-center-banner.jpg’,’../src/imgs/user-center-banner2.jpg’], people:[’张三’,’李四’], peopleObj:’王二’, peoples:’2’, portrait:[’../src/imgs/user-center-banner.jpg’,’../src/imgs/user-center-banner2.jpg’], nickname:[’人一’,’人二’]} }}
如何利用ajax与后台进行数据交互
问题解答
回答1:用axios,然后
axios.post(url, params:{peoples: this.peoples,nickname: this.nickname})
具体看axios文档
回答2:你可以写原生ajax啊。原生写法详细请看:http://www.jianshu.com/p/9b86...或者参考w3cschool
回答3:axios或者vue-resource
回答4:用jQ啊,配合Vue适合小白。
相关文章: