Taro 丨 taro-ui sass引入报错
问题:版本兼容性问题
问题:tarojs3.x 和 taro-ui2.x 不兼容;
改成:tarojs3.x 和 taro-ui3.x 兼容;
- 参考:package.json
"dependencies": {
"@tarojs/taro": "3.3.8",
},
"devDependencies": {
"taro-ui": "^3.0.0-alpha.3",
},
- app.tsx
import 'taro-ui/dist/style/index.scss'
- home.tsx
import { AtSearchBar } from 'taro-ui'
const Home = () => {
const [search, setSearch] = useState('')
const heandleSearch = (value) => {
console.log('value===', value)
}
return (
<AtSearchBar
value={search}
onChange={heandleSearch}
/>
);
};
export default Home;