test-select-picker.vue 926 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <view>
  3. <view class="uni-title uni-common-pl">地区选择器</view>
  4. <view class="uni-list">
  5. <view class="uni-list-cell">
  6. <view class="uni-list-cell-db">
  7. <picker @change="bindPickerChange" :value="index" :range="array">
  8. <view class="uni-input">{{array[index]}}</view>
  9. </picker>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. array: ['中国', '美国', '巴西', '日本'],
  20. index: 0,
  21. }
  22. },
  23. computed: {
  24. },
  25. methods: {
  26. bindPickerChange: function(e) {
  27. console.log('picker发送选择改变,携带值为', e.target.value)
  28. this.index = e.target.value
  29. },
  30. }
  31. }
  32. </script>
  33. <style>
  34. </style>