12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <template>
- <el-select
- v-model="selected"
- class="size-select"
- placeholder="请选择"
- @change="select"
- style="width: 100px;"
- clearable
- >
- <el-option
- v-for="item in optionList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- <span>{{ item.name }}</span>
- </el-option>
- </el-select>
- </template>
- <script>
- export default {
- name: "OrgSelect",
- props: {
- value: [String, Array],
- },
- data() {
- return {
- optionList: [],
- selected: "",
- };
- },
- async created() {
- const res = await this.$http.post("/api/admin/sys/org/query");
- // console.log(res.data);
- this.optionList = res.data.data.records;
- },
- watch: {
- value: {
- immediate: true,
- handler(val) {
- this.selected = val;
- },
- },
- },
- methods: {
- select() {
- this.$emit("input", this.selected);
- this.$emit("change", this.selected);
- },
- },
- };
- </script>
- <style></style>
|