工作27:组件封装
<!--封裝部門選擇的插件 需要的組件-->
<template><el-select :value="value" placeholder="請選擇所屬欄目" @change="handleChange"><!--注意用戶的返回值--><el-option v-for="value in column" :label="value" :value="value"></el-option></el-select>
</template><script>
import { getAction } from "@/api";
export default {name: "SelectLabel",/*用于和父組件通信*/props: {value: String},model: {prop: "value",event: "change"},data() {return {/*存儲所屬的數據*/column:[]};},created() {/*請求方法*/this.list();},methods: {list() {/*請求接口的方法*/getAction("/department/attribute/1").then(res => {console.log(1)console.log(res.data.column)this.column=res.data.column});},/*方法調用*/handleChange(val) {this.$emit("change", val);}}
};
</script><style scoped></style>
?
總結
- 上一篇: 前端学习(2039)vue之电商管理系统
- 下一篇: 国内外IGS数据及产品下载网站