index.vue 839 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view>
  3. <u-dropdown v-if="options != null" style="width:100%; display: flex;">
  4. <u-dropdown-item height="450" @change="changitem" v-model="value" :title="ctitle" :options="options"></u-dropdown-item>
  5. </u-dropdown>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. props: {
  11. title: {
  12. type: String,
  13. },
  14. options: {
  15. type: Array
  16. },
  17. },
  18. data() {
  19. return {
  20. ctitle: "",
  21. value:''
  22. }
  23. },
  24. created() {
  25. this.ctitle = this.title
  26. },
  27. methods: {
  28. changitem(val) {
  29. let item = this.itemfind(val)
  30. this.ctitle = item.label
  31. this.$emit("getroomList", val,-1)
  32. },
  33. //查找标题
  34. itemfind(index) {
  35. return this.options.find(e => e.value == index)
  36. },
  37. }
  38. }
  39. </script>
  40. <style>
  41. .u-dropdown {
  42. display: flex;
  43. }
  44. .u-dropdown__menu{
  45. border: 1px solid red;
  46. }
  47. </style>