网站互动化,嘉兴企业做网站,工信部网站备案平台,国家工商商标注册官网查询练手项目vue页面
新手前端轻喷#xff1a; 效果如下 1、2两个部分组成#xff1a; 对应代码中 element-ui中的 el-form 和 el-table
照着抄呗#xff0c;硬着头皮来#xff01; 建议#xff1a;认真读一遍你用的组件 那上边简单得列表举例#xff1a; 建议大家手敲一个…练手项目vue页面
新手前端轻喷 效果如下 1、2两个部分组成 对应代码中 element-ui中的 el-form 和 el-table
照着抄呗硬着头皮来 建议认真读一遍你用的组件 那上边简单得列表举例 建议大家手敲一个最简单的
可能出现的坑点
1、js语句没有写道script标签内。 2、自定义方法没有写道method:{}中 3、在funtion(){}中调用this方法 和在{}中调用this的this不是一个对象 4、标签拼错了 比如 prop敲成porp templatediv classapp-container!-- el-form sizesmall :inlinetrue label-width100px/el-form --el-table stylewidth: 100%; :datalunboListel-table-column label序号 typeindex aligncenter/el-table-columnel-table-column label轮播图id aligncenter propimageId /el-table-column label图片 aligncenter propimageUrl :show-overflow-tooltiptruetemplate slot-scope{row}el-image :srcrow.imageUrl stylewidth: 160px; height: 90px;/el-image/template/el-table-columnel-image :srcimageUrl/el-imageel-table-column label备注 aligncenter propremark /el-table-column label状态 aligncenter propstatus keystatus template slot-scopescopeel-switchv-modelscope.row.status:active-value1:inactive-value0changehandleStatusChange(scope.row)/el-switch/template/el-table-column/el-table/div/template上边的问题3[最早的代码是then(function(){}) 但这是不对的]
scriptimport {getLunbolist,updateLuobo} from /api/school/commonexport default {name: ,data() {return {lunboList: [{imageUrl:,remark:,status: 0}],}},created() {this.getLunboList();},methods:{// 用户状态修改handleStatusChange(row) {console.log(修改后row传入数据,row)let imageId row.imageId;let text row.status 1 ? 启用 : 停用;this.$modal.confirm(确认要 text row.imageId 记录吗).then(() {return this.changeLunboStatus(row.imageId, row.status);}).catch((error){console.log(出现错误,error)}).then(() {this.$modal.msgSuccess(text 成功);}).catch(function() {row.status row.status 0 ? 1 : 0;});},// 获取lunbo列表getLunboList() {console.log(qqqqqqqqqqqqqqqqqqqqqqqq)getLunbolist().then(res{console.log(res);this.lunboList res.rows;})},changeLunboStatus(imageId,status){console.log(修改轮播status,imageId,status)let data {imageId:imageId,status:status}console.log(修改轮播status组装数据data,data)updateLuobo(data).then(res{this.getLunboList()})}},};
/scriptstyle scope
/style