Initial commit
This commit is contained in:
70
components/dic-select/select-show.vue
Normal file
70
components/dic-select/select-show.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-picker :show="show" :loading="loading" ref="uPicker" :columns="columns" @confirm="confirm" keyName="dicName"
|
||||
@cancel="show = false"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
name:"select-show"
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
code: {
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请选择"
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getDic();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns: [
|
||||
[
|
||||
|
||||
]
|
||||
],
|
||||
loading: false,
|
||||
value:undefined,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getDic() {
|
||||
const that = this;
|
||||
this.loading = true;
|
||||
axios.get("/dic/queryByDicType", {
|
||||
"dicType": this.code
|
||||
}).then(res => {
|
||||
that.columns[0]=res;
|
||||
that.$refs.uPicker.setColumnValues(0, res);
|
||||
that.loading = false;
|
||||
}).catch(error => {
|
||||
that.loading = false;
|
||||
this.closeShow();
|
||||
});
|
||||
},
|
||||
confirm(e) {
|
||||
this.value = e.value[0].dicCode;
|
||||
this.$emit("selectChangeValue",e.value[0].dicCode)
|
||||
this.$emit("selectChange",e.value[0])
|
||||
this.closeShow();
|
||||
},
|
||||
closeShow(){
|
||||
this.$emit("closeShow",false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user