siteOptions

This commit is contained in:
quantulr
2022-08-30 12:14:35 +08:00
parent 5983e1e31b
commit bff17dd1b1
8 changed files with 91 additions and 253 deletions

View File

@ -3,13 +3,13 @@
:model-value="modelValue"
placeholder="请选择,支持搜索"
size="default"
:loading="dataStore.siteList.length === 0"
:loading="siteList.length == 0"
@change="valueChanged"
filterable
clearable
>
<el-option
v-for="item in dataStore.siteList"
v-for="item in siteList"
:key="item.id"
:label="item.name"
:value="item.id"
@ -17,32 +17,22 @@
</el-select>
</template>
<script setup name="SiteOptions">
import useDataStore from "@/store/modules/data";
import { ref, toRefs } from "vue";
import { toRefs } from "vue";
const props = defineProps({
modelValue: {
type: [Number, String],
},
siteList: {
type: Array,
required: true,
},
});
const { modelValue } = toRefs(props);
const dataStore = useDataStore();
dataStore.setSiteList();
// const siteList = ref([]);
const { modelValue, siteList } = toRefs(props);
const emit = defineEmits(["update:modelValue"]);
// // 获取站点列表
// const getSiteList = async () => {
// const { rows } = await tenantSelect();
// siteList.value = rows;
// dataStore.setSiteList(rows);
// };
const valueChanged = (val) => {
console.log("changed");
emit("update:modelValue", val);
};
// getSiteList();
dataStore.setSiteList();
</script>