taro-ui icon indicating copy to clipboard operation
taro-ui copied to clipboard

form表单在微信开发中工具中编译不出来

Open wojiaoshupian opened this issue 1 year ago • 1 comments

问题描述

小程序模版编译报错 复现步骤

const Index = () => {
  const {handleLogin,isLogin} = useUserStore()
  const [value, setValue] = useState(''); // 使用 useState 来管理状态

  const handleChange = (value) => {
    setValue(value); // 更新状态
  };

  const onSubmit = (event) => {
    console.log(value); // 提交时打印当前值
  };

  const onReset = (event) => {
    setValue(''); // 重置状态
  };

  useDidShow(()=>{
    if(!isLogin){
      handleLogin()
    }

  })
  return (
    <View className="wrapper text-green-800">
       <AtForm
      onSubmit={onSubmit}
      onReset={onReset}
    >
      <AtInput 
        name='1234' 
        title='文本' 
        type='text' 
        placeholder='单行文本' 
        value="123"
        
      />
   
    </AtForm>
  
      <view style={{ height: '100px' }}>
        <TabBar></TabBar>
      </view>
    </View>
  );
};

export default Index;

期望行为

能正常编译 报错信息

Image

系统信息

补充信息

wojiaoshupian avatar Feb 20 '25 04:02 wojiaoshupian

config/index.ts 里面修改

// compiler: 'webpack5',
   compiler: {
      type: 'webpack5',
      prebundle: {
        exclude: ['taro-ui']
      }
    },

Pcxy avatar Mar 31 '25 09:03 Pcxy