import { ref, onMounted } from 'vue'

export function useEnv() {
  const isWeChat = ref(false)
  onMounted(() => {
    // #ifdef H5
    const ua = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : ''
    isWeChat.value = /micromessenger/.test(ua)
    // #endif
    // #ifdef MP-WEIXIN
    isWeChat.value = true
    // #endif
  })
  return { isWeChat }
}
