combox.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view class="container">
  3. <uni-card :is-shadow="false" is-full>
  4. <text class="uni-h6">组合框一般用于可以选择也可以输入的表单项。</text>
  5. </uni-card>
  6. <uni-section title="基本用法" type="line">
  7. <view class="example-body">
  8. <uni-combox :candidates="candidates" placeholder="请选择所在城市" v-model="city"></uni-combox>
  9. <view class="result-box">
  10. <text>所选城市为:{{city}}</text>
  11. </view>
  12. </view>
  13. </uni-section>
  14. <uni-section title="无边框" subTitle="使用 border = false 取消边框" type="line">
  15. <view class="example-body">
  16. <uni-combox :border="false" :candidates="candidates" placeholder="请选择所在城市"></uni-combox>
  17. </view>
  18. </uni-section>
  19. <uni-section title="设置无匹配项时的提示语" subTitle="使用 emptyTips 属性设置无匹配项时的提示语" type="line">
  20. <view class="example-body">
  21. <uni-combox emptyTips="这里啥都没有" placeholder="请选择所在城市"></uni-combox>
  22. </view>
  23. </uni-section>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. components: {},
  29. data() {
  30. return {
  31. candidates: ['北京', '南京', '东京', '武汉', '天津', '上海', '海口'],
  32. city: ''
  33. }
  34. },
  35. methods: {
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. .example-body {
  41. padding: 12px;
  42. background-color: #FFFFFF;
  43. }
  44. .result-box {
  45. text-align: center;
  46. padding: 20px 0px;
  47. font-size: 16px;
  48. }
  49. </style>