is-simulator.uvue 667 B

1234567891011121314151617181920212223242526
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex:1">
  4. <!-- #endif -->
  5. <view>
  6. <page-head :title="'isSimulator'"></page-head>
  7. <view class="uni-common-mt" style="justify-content: center;align-items: center;">
  8. <text>{{
  9. isSimulator ? "当前设备是模拟器" : "当前设备不是模拟器"
  10. }}</text>
  11. <text>\n注:有些模拟器会故意伪装为真机,此时识别可能会不准确</text>
  12. </view>
  13. </view>
  14. <!-- #ifdef APP -->
  15. </scroll-view>
  16. <!-- #endif -->
  17. </template>
  18. <script setup>
  19. const isSimulator = ref(false)
  20. isSimulator.value = uni.isSimulator()
  21. </script>
  22. <style>
  23. </style>