Skip to content

Commit 05e35c3

Browse files
committed
fix(view): 获取和更新数据
1 parent a5c9a7b commit 05e35c3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

admin/src/views/config/index.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</template>
2323

2424
<script>
25-
import { postAdd } from '@/api/config'
25+
import { postAdd, getList } from '@/api/config'
2626
2727
export default {
2828
data() {
@@ -44,7 +44,18 @@ export default {
4444
redirect: '/config/index'
4545
}
4646
},
47+
created() {
48+
this.init()
49+
},
4750
methods: {
51+
init() {
52+
const that = this
53+
getList({ perPage: 20 }).then(response => {
54+
const data = response.data
55+
that.form.name = data.name
56+
that.form.default_open = data.default_open
57+
})
58+
},
4859
onSubmit(form) {
4960
// console.log(this.form)
5061
this.$refs[form].validate((valid) => {
@@ -58,7 +69,7 @@ export default {
5869
message: '操作成功',
5970
type: 'success'
6071
})
61-
this.$router.push({ path: this.redirect || '/' })
72+
// this.$router.push({ path: this.redirect || '/' })
6273
} else {
6374
this.$message.error(response.reason)
6475
}

0 commit comments

Comments
 (0)