index.vue 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div class="select1">
  3. <p>{{title}}</p>
  4. <el-select v-model="result" clearable @clear="clearCatory" placeholder="请选择" size="small" @change="change" width="100px">
  5. <el-option
  6. v-for="item in list"
  7. :key="item.value"
  8. :label="item.label"
  9. :value="item.value">
  10. </el-option>
  11. </el-select>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: '',
  17. data() {
  18. return {
  19. result:this.default == true ? this.list[0] ? this.list[0].value : '' : ''
  20. };
  21. },
  22. props:['title','list','default'],
  23. computed:{
  24. },
  25. watch:{
  26. },
  27. methods: {
  28. change() {
  29. this.$emit('selectChange',this.result)
  30. },
  31. clearCatory() {
  32. this.$emit('clearCategory')
  33. }
  34. },
  35. };
  36. </script>
  37. <style scoped>
  38. .select1 {
  39. display: flex;
  40. align-items: center;
  41. }
  42. p {
  43. margin-right: 8px;
  44. font-size: 14px;
  45. color: #666666;
  46. }
  47. /deep/.el-select {
  48. width: 150px !important;
  49. }
  50. </style>