<template>
  <div style="overflow-y: auto">
    <h1>radio</h1>
    <div>
      参数：input1，值：{{form.input1}}
      <CusFormColumn
          link="radio"
          label="普通"
          v-model:param="form.input1"
          :options="$store.state.dictionary.pboatTypeList"
      />
    </div>
    <h2>静态数据 static  (valueKey, labelKey)</h2>
    <div>
      参数：input1，值：{{form.input1}}
      <CusFormColumn
          link="radio"
          label="普通"
          v-model:param="form.input1"
          :options="[
              {label: '111', value: '1'},
              {label: '222', value: '2'},
              {label: '333', value: '3'},
          ]"
          static
          labelKey="label"
          valueKey="value"
      />
    </div>
    <h2>获取选中对象  @getObject</h2>
    <div>
      参数：input1，值：{{form.input1}}
      参数：obj1，值：{{form.obj1}}
      <CusFormColumn
          link="radio"
          label="普通"
          v-model:param="form.input1"
          :options="$store.state.dictionary.pboatTypeList"
          @getObject="onGetObject"
      />
    </div>
  </div>
</template>

<script lang="ts">
import {
  defineComponent,
  computed,
  onMounted,
  ref,
  reactive,
  watch,
  getCurrentInstance,
  ComponentInternalInstance,
  toRefs,
  nextTick
} from 'vue'
import {useStore} from 'vuex'
import {useRouter, useRoute} from 'vue-router'

export default defineComponent({
  name: '',
  components: {},
  setup() {
    const store = useStore();
    const router = useRouter();
    const route = useRoute();
    const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
    const state = reactive({
      form: {
        input1: null,
        obj1: null,
      }
    })
    const initDictionary = () => {
      store.dispatch("dictionary/LOAD_DICT_LIST", "pboat_type");
    }
    const onGetObject = (val) => {
      state.form.obj1 = val
    }
    onMounted(() => {
      initDictionary()
    })
    return {
      ...toRefs(state),
      onGetObject
    }
  },
})
</script>

<style scoped lang="scss">
</style>
