| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <div>
- <el-cascader
- :clearable="true"
- v-model="select_val"
- placeholder="请选择分类"
- :options="options"
- @change="handleChange"
- />
- </div>
- </template>
- <script>
- export default {
- props: {
- value: {
- },
- type: {
- type: Number,
- default: 0
- },
- category_change:{
- type: Function,
- }
- },
- data() {
- return {
- type_val: 0,
- select_val: [],
- options: []
- }
- },
- watch:{
- type:function (newVal,oldVal) {
- this.type_val = newVal
- this.getCateGory()
- }
- },
- mounted() {
- this.type_val = this.type
- this.getCateGory()
- },
- methods: {
- handleChange(value) {
- this.$emit('input', value);
- if(typeof(this.category_change)=="function")
- {
- this.category_change(this.select_val[1]);
- }
- },
- async getCateGory() {
- const res =await this.$post('/uapi/pub/list/admin/category/get_cate_ab', { type: this.type_val })
- this.options = res.data
- }
- }
- }
- </script>
- <style scoped>
- .screenfull-svg {
- display: inline-block;
- cursor: pointer;
- fill: #5a5e66;;
- width: 20px;
- height: 20px;
- vertical-align: 10px;
- }
- </style>
|