test.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="content">
  3. <jContacts ref="jContacts" :mode="mode" :hashFirst="hashFirst" @confirm="contactsConfirm" @cancel="contactsCancel"></jContacts>
  4. <button type="default" @tap="show('single')">单选模式</button>
  5. <button type="default" @tap="show('multi')">多选模式</button>
  6. <button type="default" @tap="chooseList = []">清除</button>
  7. <view class="res" v-for="(value, index) in chooseList" :key="index">
  8. {{value.name}}&nbsp;&nbsp;{{value.phone}}
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import jContacts from "@/components/j-contacts/j-contacts.vue"
  14. export default {
  15. components: {
  16. jContacts,
  17. },
  18. data() {
  19. return {
  20. showMask: false,
  21. mode: "single",
  22. hashFirst: false,
  23. chooseList: [],
  24. }
  25. },
  26. methods: {
  27. show(mode) {
  28. this.showMask = true
  29. this.mode = mode
  30. this.$refs.jContacts.show()
  31. },
  32. contactsConfirm(res) {
  33. this.chooseList = res
  34. console.log("返回结果:", JSON.stringify(this.chooseList))
  35. },
  36. contactsCancel(){
  37. },
  38. },
  39. }
  40. </script>