I'm trying to create a model to be able to edit existing data? How would I go about doing that?
I'm using a <el-form>
to create a new entry in this case I'm creating questions, I want to reuse this for the edit and have the data from the entry added into the form.
This is my form right now
<el-dialog title="Nuevo" :loading="loading" :visible="dialogFormVisible" :visible.sync="dialogFormVisible">
<el-form label-position="top" ref="form" :model="form" :rules="rules">
<el-row>
<el-form-item label="Pregunta" prop="question">
<el-input v-model="form.question"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="Seccion" prop="survey_section_id">
<el-select v-model="form.survey_section_id" placeholder="Selecionar">
<el-option v-for="section in survey_section" :key="section.id" :label="section.title"
:value="section.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="Tipo de Respuesta" prop="response_type">
<el-select v-model="form.response_type_id" placeholder="Selecionar">
<el-option v-for="type in response_type" :key="type.id" :label="type.type" :value="type.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="Opcional" prop="optional">
<el-switch v-model="form.optional"></el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer">
<el-button type="info" @click="dialogFormVisible = false">Cancelar
</el-button>
<el-button type="primary" :loading="loading" @click="submit('form')">Guardar
</el-button>
</span>
</el-dialog>
What do I need to do to turn this into a modal and use it for my editing as well?
Ask me anything, I can provide any code that I have that is needed. Thanks