<template>
  <div>
    <div class="q-pa-sm">
      <q-btn dense @click="showonly=!showonly" label="只读" :outline="!showonly" color="primary" />
      <q-btn dense @click="setValue()" label="外部设置" class="q-mx-sm" color="primary" />
    </div>
    <q-separator />
    <q-card class="q-ma-sm q-pa-sm bg-grey-3">
      <div>单选/common/MData</div>
      <kyb-select-entity
        entity="/common/MData"
        title-key="title"
        :query-param="{_level:1}"
        :showonly="showonly"
        v-model="selectedList"
      />
      选择的值：{{selectedList}}
    </q-card>
    <q-card class="q-ma-sm q-pa-sm bg-grey-3">
      <div>多选/common/MData</div>
      <kyb-select-entity
        entity="/common/MData"
        title-key="title"
        :query-param="{_level:1}"
        :showonly="showonly"
        v-model="selected2List"
        selectType="more"
      />
      选择的值：{{selected2List}}
    </q-card>
    <q-card class="q-ma-sm q-pa-sm bg-grey-3">
      单选/test/Test
      <kyb-select-entity entity="/test/Test" :showonly="showonly" v-model="selected3List" />
      选择的值：{{selected3List}}
    </q-card>
  </div>
</template>
<script>
export default {
  props: {},
  data() {
    return {
      showonly: false,
      selectedList: ['/common/Resource'],
      selected2List: ['/common/Page', '/common/Resource'],
      selected3List: ['dfdf']
    }
  },
  methods: {
    setValue() {
      this.selectedList = ['/common/MData']
      this.selected2List = ['/common/MData']
    }
  }
}
</script>
