index.nvue 638 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view class="content">
  3. {{title}}
  4. <u-button @click="show" type="primary" text="选择城市"></u-button>
  5. <!-- 城市组件 -->
  6. <city ref="city" @confirm="confirm"></city>
  7. </view>
  8. </template>
  9. <script>
  10. import city from '@/components/city-index/index.vue'
  11. export default {
  12. components: {
  13. city
  14. },
  15. data() {
  16. return {
  17. title:''
  18. }
  19. },
  20. onLoad() {
  21. },
  22. methods: {
  23. // 确定选择
  24. confirm(e,e1,e2) {
  25. console.log(e,e1,e2)
  26. this.title = e.name+e1.name+e2.name
  27. },
  28. // 显示
  29. show() {
  30. this.$refs.city.showd()
  31. }
  32. }
  33. }
  34. </script>
  35. <style>
  36. .content {
  37. padding: 100rpx;
  38. }
  39. </style>