From 5529b7077126be368abd444d45ec085d8c7779e3 Mon Sep 17 00:00:00 2001 From: 明梦爽 <2972214568@qq.com> Date: 星期日, 17 四月 2022 23:21:22 +0800 Subject: [PATCH] eslint语法规范 --- src/components/Administrator/AdEdit.vue | 127 ++++++++++++++++++------------------------ 1 files changed, 54 insertions(+), 73 deletions(-) diff --git a/src/components/Administrator/AdEdit.vue b/src/components/Administrator/AdEdit.vue index a87374c..1a20dce 100644 --- a/src/components/Administrator/AdEdit.vue +++ b/src/components/Administrator/AdEdit.vue @@ -1,24 +1,16 @@ <template> <div> <el-card class="box-card"> - <el-button type="primary" @click="add()" icon="el-icon-circle-plus" class='add'>娉ㄥ唽鏂扮殑绠$悊鍛樿处鍙�</el-button> + <el-button type="primary" @click="add()" icon="el-icon-circle-plus" class="add">娉ㄥ唽鏂扮殑绠$悊鍛樿处鍙�</el-button> <!-- 鏂伴椈琛ㄦ牸鍖哄煙 --> - <el-table - :data="tableData" - border - style="width: 100%" - :header-cell-style="{textAlign: 'center'}" - :cell-style="{ textAlign: 'center' }" - > + <el-table :data="tableData" border style="width: 100%" :header-cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"> <el-table-column type="index" label="搴忓彿" width="50"> <!-- <template slot-scope="scope"> <span>{{ (currentPage-1)*pageSize+scope.$index+1 }}</span> </template> --> </el-table-column> - <el-table-column prop="username" label="鏅�氱鐞嗗憳璐﹀彿" width="" > - </el-table-column> - <el-table-column prop="id" label="id" width=""> - </el-table-column> + <el-table-column prop="username" label="鏅�氱鐞嗗憳璐﹀彿" width=""> </el-table-column> + <el-table-column prop="id" label="id" width=""> </el-table-column> <el-table-column label="鎿嶄綔" width=""> <template slot-scope="scope"> <!-- {{ scope.row.id }} --> @@ -27,18 +19,13 @@ <el-button type="danger" @click="deleteAds(scope.row.id)" icon="el-icon-delete"></el-button> </div> </template> - </el-table-column> </el-table> </el-card> <!-- 淇敼璐︽埛鐨勫璇濇 --> - <el-dialog - title="淇敼鏅�氱鐞嗗憳瀵嗙爜" - :visible.sync="editDialogVisible" - width="50%" - @close="editClose"> + <el-dialog title="淇敼鏅�氱鐞嗗憳瀵嗙爜" :visible.sync="editDialogVisible" width="50%" @close="editClose"> <!-- rules琛ㄥ崟楠岃瘉瑙勫垯锛宺ef褰撳墠琛ㄥ崟鐨勯獙璇佸璞� --> - <el-form ref="editFormRef" :model="editForm" label-width="80px" status-icon> + <el-form ref="editFormRef" :model="editForm" label-width="80px" status-icon> <el-form-item label="鐢ㄦ埛鍚�:"> <el-input v-model="editForm.username" prefix-icon="iconfont icon-user" placeholder="璇疯緭鍏ヨ处鍙�" clearable=""></el-input> </el-form-item> @@ -55,13 +42,9 @@ </span> </el-dialog> <!-- 娣诲姞绠$悊鍛樺璇濇 --> - <el-dialog - title="娣诲姞鏅�氱鐞嗗憳" - :visible.sync="addDialogVisible" - width="50%" - @close="addClose"> + <el-dialog title="娣诲姞鏅�氱鐞嗗憳" :visible.sync="addDialogVisible" width="50%" @close="addClose"> <!-- rules琛ㄥ崟楠岃瘉瑙勫垯锛宺ef褰撳墠琛ㄥ崟鐨勯獙璇佸璞� --> - <el-form ref="addFormRef" :model="addForm" label-width="80px" status-icon> + <el-form ref="addFormRef" :model="addForm" label-width="80px" status-icon> <el-form-item label="鐢ㄦ埛鍚�:"> <el-input v-model="addForm.username" prefix-icon="iconfont icon-user" placeholder="璇疯緭鍏ヨ处鍙�" clearable=""></el-input> </el-form-item> @@ -78,65 +61,65 @@ </template> <script> -import { getmain,editAccount,deleteAd,addAd } from '../../api/api' +import { getmain, editAccount, deleteAd, addAd } from '../../api/api' export default { data() { return { - tableData:[], //鏅�氱鐞嗗憳鍒楄〃 - editDialogVisible:false, - addDialogVisible:false, - editForm:{ username:'',oldPassword:'',password:'' }, //淇敼琛ㄥ崟瀵硅薄 - addForm:{ username:'',password:'' } //娣诲姞绠$悊瀵硅薄 + tableData: [], //鏅�氱鐞嗗憳鍒楄〃 + editDialogVisible: false, + addDialogVisible: false, + editForm: { username: '', oldPassword: '', password: '' }, //淇敼琛ㄥ崟瀵硅薄 + addForm: { username: '', password: '' } //娣诲姞绠$悊瀵硅薄 } }, - created(){ + created() { this.ready() }, - methods:{ + methods: { //鑾峰彇閾虹鍒楄〃 - ready(){ + ready() { getmain().then(res => { // console.log(res); - if(res.code == 200){ + if (res.code == 200) { this.tableData = res.data } }) }, //灞曠ず缂栬緫瀵硅瘽妗� - showEditDialog(){ + showEditDialog() { this.editDialogVisible = true }, - editClose(){ - this.editForm.username = ''; - this.editForm.oldPassword = ''; - this.editForm.password = ''; + editClose() { + this.editForm.username = '' + this.editForm.oldPassword = '' + this.editForm.password = '' }, - cancel(){ - this.editForm.username = ''; - this.editForm.oldPassword = ''; - this.editForm.password = ''; + cancel() { + this.editForm.username = '' + this.editForm.oldPassword = '' + this.editForm.password = '' this.editDialogVisible = false }, //缂栬緫纭畾浜嬩欢 - subEdit(){ + subEdit() { const data = { - username:this.editForm.username, - oldPassword:this.editForm.oldPassword, - password:this.editForm.password + username: this.editForm.username, + oldPassword: this.editForm.oldPassword, + password: this.editForm.password } editAccount(data).then(res => { // console.log(res); - if(res.code == 200){ + if (res.code == 200) { this.$message.success('璐︽埛淇敼鎴愬姛') this.editDialogVisible = false this.ready() - }else{ + } else { this.$message.error('璐︽埛淇敼澶辫触') } }) }, //鍒犻櫎鏅�氱鐞嗗憳 - async deleteAds(id){ + async deleteAds(id) { // console.log(id); const res = await this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ョ鐞嗚处鍙�, 鏄惁缁х画?', '鎻愮ず', { confirmButtonText: '纭畾', @@ -147,63 +130,61 @@ }) //濡傛灉鐢ㄦ埛鐐瑰嚮纭畾鍒欒繑鍥瀋onfirm //濡傛灉鐢ㄦ埛鐐瑰嚮鍙栨秷鍒欒繑鍥瀋ancel - console.log(res); - if(res !== 'confirm'){ + console.log(res) + if (res !== 'confirm') { return this.$message.info('宸插彇娑堝垹闄') - }else{ + } else { // console.log(id); const data = { - id:id + id: id } //鍙傛暟data 瑕佷互瀵硅薄鐨勫舰寮忎紶鍏� deleteAd(data).then(res => { // console.log('>>>'+res); - if(res.code == 200){ + if (res.code == 200) { this.$message.success('鍒犻櫎鎴愬姛锛�') this.ready() - }else{ + } else { return this.$message.error('鍒犻櫎澶辫触锛�') } }) } }, - add(){ + add() { this.addDialogVisible = true }, //娉ㄥ唽鍙栨秷娓呯┖ - canceladd(){ - this.addForm.username = ''; - this.addForm.password = ''; + canceladd() { + this.addForm.username = '' + this.addForm.password = '' this.addDialogVisible = false }, - addClose(){ - this.addForm.username = ''; - this.addForm.password = ''; + addClose() { + this.addForm.username = '' + this.addForm.password = '' }, //娉ㄥ唽鎻愪氦 - addEdit(){ + addEdit() { const data = { - username:this.addForm.username, - password:this.addForm.password + username: this.addForm.username, + password: this.addForm.password } addAd(data).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.$message.success('娉ㄥ唽鎴愬姛') this.addDialogVisible = false this.ready() - }else{ + } else { this.$message.error('娉ㄥ唽澶辫触') } }) - } } } </script> <style lang="less" scoped> -.add{ +.add { margin-bottom: 10px; } - -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0