selectCity.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view class="">
  3. <citySelect @back_city="back_city"></citySelect>
  4. </view>
  5. </template>
  6. <script>
  7. import citySelect from '@/components/linzq-citySelect/linzq-citySelect.vue';
  8. export default {
  9. components: {
  10. citySelect
  11. },
  12. data() {
  13. return {
  14. statusBarHeight:''
  15. }
  16. },
  17. onLoad() {
  18. let that = this
  19. uni.getSystemInfo({
  20. success: function(res) {
  21. console.log("statusBarHeight", res.statusBarHeight)
  22. that.statusBarHeight += res.statusBarHeight + "px"; //这就是状态栏的高度
  23. },
  24. });
  25. },
  26. methods: {
  27. back_city(e) {
  28. if (e.positionName !== 'no') {
  29. this.region = e.positionName.cityName
  30. }
  31. if(!e.positionName.cityName){
  32. var tmp = e.positionName
  33. e.positionName = {}
  34. e.positionName.cityName = tmp
  35. }
  36. console.log("city:",e)
  37. uni.setStorage({
  38. key: 'nowRegion',
  39. data: e,
  40. success() {
  41. uni.navigateBack({
  42. })
  43. }
  44. });
  45. }
  46. }
  47. }
  48. </script>
  49. <style>
  50. .container {
  51. padding: 20px;
  52. font-size: 14px;
  53. line-height: 24px;
  54. }
  55. </style>