<template>
	<div class="hui-flex hui-dialog">
		<div class="hui-flex-box hui-dialog-content">
			<el-form ref="menuForm" :model="menuForm" label-position="top">
				<el-form-item label="菜单名称">
					<el-input v-model="menuForm.title"></el-input>
				</el-form-item>
				<el-form-item label="菜单URL">
					<el-input v-model="menuForm.index"></el-input>
				</el-form-item>
				<el-form-item label="菜单图标">
					<el-input v-model="menuForm.iconClass"></el-input>
				</el-form-item>
				<el-form-item label="是否菜单">
					<el-radio v-model="menuForm.isMenu" label="1">是</el-radio>
					<el-radio v-model="menuForm.isMenu" label="2">否</el-radio>
				</el-form-item>
			</el-form>
		</div>
		<div class="hui-dialog-submit">
			<el-button size="small" @click="$emit('callback')">取 消</el-button>
			<el-button size="small" type="primary" @click="submit">保 存</el-button>
		</div>
	</div>
</template>

<script>
	export default {
		props: ['updateData'],
		data() {
			return {
				menuForm: {
					title: '',
					index: '',
					iconClass: '',
					isMenu: '1'
				}
			}
		},
		mounted() {
			let _self = this;
			if (_self.updateData.id) _self.menuForm = _self.updateData;
		},
		methods: {
			sureIncrease() { //返回新增数据
				let _self = this;
				if (_self.menuForm.index == '') delete _self.menuForm.index;
				return _self.menuForm;
			},
			submit() {
				this.$emit('sure')
			}
		}
	}
</script>

<style lang="scss">

</style>