提交 cbe4116a authored 作者: 王鹏飞's avatar 王鹏飞

update

上级 6660240b
<template> <template>
<div id="app"> <div id="app">
<vue-form :menus="menus" default-active="profile"></vue-form> <vue-form
:menus="menus"
default-active="profile"
@change="handleChange"
@success="handleSuccess"
></vue-form>
</div> </div>
</template> </template>
<script> <script>
...@@ -11,13 +16,18 @@ export default { ...@@ -11,13 +16,18 @@ export default {
name: 'app', name: 'app',
data() { data() {
return { return {
currentActive: null,
menus: sofiaForm menus: sofiaForm
// menus: registerForm // menus: registerForm
} }
}, },
methods: { methods: {
onSubmit(data) { handleChange(value) {
console.log(data) this.currentActive = value
console.log('页面切换了', value)
},
handleSuccess(data) {
console.log('提交成功了', data)
} }
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<ezj-main :title="currentPage.title" v-if="currentPage" :key="activeId"> <ezj-main :title="currentPage.title" v-if="currentPage" :key="activeId">
<slot> <slot>
<template v-if="currentPage.form"> <template v-if="currentPage.form">
<ezj-form-pane v-bind="currentPage"></ezj-form-pane> <ezj-form-pane v-bind="currentPage" v-on="$listeners"></ezj-form-pane>
</template> </template>
</slot> </slot>
</ezj-main> </ezj-main>
...@@ -58,6 +58,7 @@ export default { ...@@ -58,6 +58,7 @@ export default {
}, },
onSelect(id) { onSelect(id) {
this.activeId = id this.activeId = id
this.$emit('change', id)
} }
} }
} }
......
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
axios.post(action, formData, { headers }).then(res => { axios.post(action, formData, { headers }).then(res => {
let { data } = res let { data } = res
callback && callback(data) callback && callback(data)
this.$emit('update', data) this.$emit('success', data)
}) })
}, },
onSubmit(data) { onSubmit(data) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论