0

I have a trouble trying to find out how to make a little thing, let me explain more below. I have a project using php-laravel, coreui vue and using a MVC Architecture, and i made my whole vue dynamic using DB, im trying to make a select with dynamic options, that means it doesnt matter what select is, just give me the options.

 <CModal
  :entered="true" 
  :title="selectedReporte ? selectedReporte.nombre:''"
  :show.sync="reporteModal"
  @close= "closeReporteModal"
  :ok-disabled="true" hide-footer 
  :closeOnBackdrop="false">
  <template v-if="selectedReporte && selectedReporte.parametros">
    <CRow v-for="parametro in selectedReporte.parametros" :key="parametro.name">
      <CCol>
        <template v-if="parametro.type === 'select'">
          <CSelect
            v-model="parametrosDinamicos[parametro.name]"
            :label="parametro.label"
            :options="['']"
            :invalid-feedback="v$.parametrosDinamicos[parametro.name].$error ? '' : ''"
            :is-valid="v$.parametrosDinamicos[parametro.name].$dirty ? !v$.parametrosDinamicos[parametro.name].$invalid : null"
          />
        </template>
        <template v-else>
          <CInput
            v-model="parametrosDinamicos[parametro.name]"
            :type="parametro.type"
            :label="parametro.label"
            :invalid-feedback="v$.parametrosDinamicos[parametro.name].$error ? '' : ''"
            :is-valid="v$.parametrosDinamicos[parametro.name].$dirty ? !v$.parametrosDinamicos[parametro.name].$invalid : null"
          />
        </template>

this is a little section of my code in vue, sorry for my english

And in my database table, I have a column called Parameters which is a JSON and looks like this

[
  {
    "name": "@SUCURSAL",
    "label": "Sucursal",
    "type": "select",
    "paramName": "T2_name"
  },
  {
    "name": "@START_DATE",
    "label": "Start DATE",
    "type": "date",
    "paramName": "START_DATE"
  },
  {
    "name": "@END_DATE",
    "label": "End DATE",
    "type": "date",
    "paramName": "END_DATE"
  }
]

So, if i add a new parameter in this Row, called "Inventory", in mi visual a new Select option appears and i need that new select with his options

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.