NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.64k stars 4.8k forks source link

nut getSystemInfoSync 不存在 #16816

Open Ocyss opened 2 weeks ago

Ocyss commented 2 weeks ago

相关平台

H5

浏览器版本: Microsoft Edge 版本 130.0.2849.68 (正式版本) (arm64) 使用框架: Vue 3

复现步骤

在 H5 端, 4.0.6, 4.0.7 官方模板均能复现, 添加`nut-circle-progress组件即可复现

<template>
  <view class="index">
    <nut-button type="primary" @click="onClick">按钮</nut-button>
    <nut-toast v-model:visible="show" msg="你成功了" />
    <nut-circle-progress :progress="50" color="skyblue" />
  </view>
</template>

期望结果

getSystemInfoSync 正常使用

实际结果

getSystemInfoSync 不存在

Uncaught (in promise) TypeError: taro.getSystemInfoSync is not a function
    at setup (CircleProgress.js:39:24)
    at callWithErrorHandling (runtime-core.esm-bundler.js:199:19)
    at setupStatefulComponent (runtime-core.esm-bundler.js:7870:25)
    at setupComponent (runtime-core.esm-bundler.js:7831:36)
    at mountComponent (runtime-core.esm-bundler.js:5179:7)
    at processComponent (runtime-core.esm-bundler.js:5145:9)
    at patch (runtime-core.esm-bundler.js:4663:11)
    at mountChildren (runtime-core.esm-bundler.js:4895:7)
    at mountElement (runtime-core.esm-bundler.js:4818:7)
    at processElement (runtime-core.esm-bundler.js:4783:7)

环境信息

👽 Taro v4.0.7

(node:27760) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

  Taro CLI 4.0.7 environment info:
    System:
      OS: macOS 12.7.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 22.4.0 - /opt/homebrew/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.8.1 - /opt/homebrew/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.7 => 4.0.7 
      @tarojs/components: 4.0.7 => 4.0.7 
      @tarojs/helper: 4.0.7 => 4.0.7 
      @tarojs/plugin-framework-vue3: 4.0.7 => 4.0.7 
      @tarojs/plugin-html: ^4.0.7 => 4.0.7 
      @tarojs/plugin-mini-ci: ^4.0.7 => 4.0.7 
      @tarojs/plugin-platform-alipay: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-h5: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-harmony-hybrid: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-jd: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-qq: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-swan: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-tt: 4.0.7 => 4.0.7 
      @tarojs/plugin-platform-weapp: 4.0.7 => 4.0.7 
      @tarojs/plugin-vue-devtools: ^4.0.7 => 4.0.7 
      @tarojs/runtime: 4.0.7 => 4.0.7 
      @tarojs/service: 4.0.7 => 4.0.7 
      @tarojs/shared: 4.0.7 => 4.0.7 
      @tarojs/taro: 4.0.7 => 4.0.7 
      @tarojs/vite-runner: 4.0.7 => 4.0.7 
      babel-preset-taro: 4.0.7 => 4.0.7 
      eslint-config-taro: 4.0.7 => 4.0.7
TheKonka commented 2 weeks ago

import { getSystemInfoSync } from '@tarojs/taro' 先这样写吧