<!-- 列表页弹出的 add / update 页面 -->
<template>
    <div class="vue-box submit-box--dialog" style="width: 600px;">
        <div class="c-card">
            <el-form :inline="false" label-width="7em">
                <in-input name="商品id：" v-model="state.model.id"></in-input>
                <in-input name="商品名称：" v-model="state.model.name"></in-input>
                <in-input name="密码输入：" v-model="state.model.password" type="password"></in-input>
                <in-input name="日期输入：" v-model="state.model.createTime" type="date"></in-input>
                <in-input name="多行输入：" v-model="state.model.name" type="textarea"></in-input>
            </el-form>
        </div>
    </div>
</template>

<script setup name="data-list-add">
import {getCurrentInstance, reactive} from "vue";
const { proxy } = getCurrentInstance();

// 获取插值 
const prop = defineProps({
    param: {type: Object}
})

// ------------------ 数据 ------------------
const state = reactive({
    id: prop.param.id || 0,  // 获取传值id 
    model: {    // 数据 Model
        id: prop.param.id || 0,
        name: '',
        password: '',
        age: 18,
        createTime: '',
        createTime2: '',
        createTime3: '',
        widthValue: 20,
        color: '#409eff',
        rate: 3,
        moneyFen: 101,
        img: '',
        audio: '',
        video: '',
        file: '',
        imgList: '',
        audioList: '',
        videoList: '',
        fileList: '',
        imgVideoList: '',
        urlList: '',
        content: '',
        status: 1,
    }
})

// 提交数据
defineExpose({
    ok: function () {
        console.log('submit!', JSON.stringify(state.model))
        sa.ajax2('/xxx', function () {
            sa.alert('提交成功', function () {
                sa.closeModel();
                sa.currView().f5();
            })
        })
    }
})

</script>

<style scoped lang="scss">

</style>
