NervJS / taro

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

taro 版本3.5.5,错误提示process is not defined和"tabId" is not defined #12492

Closed Jiajun0426 closed 2 years ago

Jiajun0426 commented 2 years ago

相关平台

微信小程序

小程序基础库: 2.26.0 使用框架: Vue 2

复现步骤

Taro 版本3.5.5 webpack5

当使用AtTabs组件时,微信小程序开发工具会提示错误

代码:

<template>
  <view class='panel__content'>
    <AtTabs
      :swipeable="false"
      :current="current1"
      :tabList="tabList1"
      :onClick="handleClick"
    >
      <AtTabsPane :current="current1" :index="0">
        <view class='tab-content'>标签页一的内容</view>
      </AtTabsPane>
      <AtTabsPane :current="current1" :index="1">
        <view class='tab-content'>标签页二的内容</view>
      </AtTabsPane>
      <AtTabsPane :current="current1" :index="2">
        <view class='tab-content'>标签页三的内容</view>
      </AtTabsPane>
    </AtTabs>
  </view>
</template>
<script>
import { AtTabs, AtTabsPane } from 'taro-ui-vue'
export default {
  components:{AtTabs,AtTabsPane},
  data() {
    return {
      current1: 0,
      tabList1: [
        { title: '标签页1' },
        { title: '标签页2' },
        { title: '标签页3' }
      ],
    }
  },
  methods: {
    handleClick(value) {
      this.current1 = value
    }
  }
}
</script>

期望结果

无错误提示

实际结果

vendors-node_modules_taro_weapp_prebundle_vue_js.js?t=wechat&s=1663230181230&v=f2e7429591651ae9d4e275c376c3fafc:3437 [Vue warn]: Error in data(): "ReferenceError: process is not defined"

found in

---> at node_modules/taro-ui-vue/src/components/tabs/index.vue

at src/pages/my/index.vue (env: macOS,mp,1.06.2209070; lib: 2.26.0) [Vue warn]: Property or method "tabId" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> at node_modules/taro-ui-vue/src/components/tabs/index.vue at src/pages/my/index.vue (env: macOS,mp,1.06.2209070; lib: 2.26.0) ### 环境信息 ``` Taro CLI 3.5.5 environment info: System: OS: macOS 12.5.1 Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm npmPackages: @tarojs/cli: 3.5.5 => 3.5.5 @tarojs/components: 3.5.5 => 3.5.5 @tarojs/helper: 3.5.5 => 3.5.5 @tarojs/mini-runner: 3.5.5 => 3.5.5 @tarojs/plugin-framework-vue2: 3.5.5 => 3.5.5 @tarojs/plugin-platform-alipay: 3.5.5 => 3.5.5 @tarojs/plugin-platform-jd: 3.5.5 => 3.5.5 @tarojs/plugin-platform-qq: 3.5.5 => 3.5.5 @tarojs/plugin-platform-swan: 3.5.5 => 3.5.5 @tarojs/plugin-platform-tt: 3.5.5 => 3.5.5 @tarojs/plugin-platform-weapp: 3.5.5 => 3.5.5 @tarojs/router: 3.5.5 => 3.5.5 @tarojs/runtime: 3.5.5 => 3.5.5 @tarojs/shared: 3.5.5 => 3.5.5 @tarojs/taro: 3.5.5 => 3.5.5 @tarojs/taro-h5: 3.5.5 => 3.5.5 @tarojs/webpack5-runner: ^3.5.5 => 3.5.5 babel-preset-taro: 3.5.5 => 3.5.5 eslint-config-taro: 3.5.5 => 3.5.5 ```
a992681784 commented 1 year ago

请问解决了吗 遇到同样的问题了 说是webpack5升级后的改动 不会在页面中注入process了 但是不知道怎么改