change to class
parent
6f896c8695
commit
14b302bd1a
|
|
@ -27,7 +27,12 @@ export default defineConfig(async (merge, { command, mode }) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
framework: 'react',
|
framework: 'react',
|
||||||
compiler: 'webpack5',
|
compiler: {
|
||||||
|
type: 'webpack5',
|
||||||
|
prebundle: {
|
||||||
|
exclude: ['taro-ui']
|
||||||
|
}
|
||||||
|
},
|
||||||
cache: {
|
cache: {
|
||||||
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
||||||
},
|
},
|
||||||
|
|
@ -58,6 +63,7 @@ export default defineConfig(async (merge, { command, mode }) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
h5: {
|
h5: {
|
||||||
|
esnextModules: ['taro-ui'],
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
staticDirectory: 'static',
|
staticDirectory: 'static',
|
||||||
output: {
|
output: {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { PropsWithChildren } from 'react'
|
import { PropsWithChildren } from 'react'
|
||||||
import { useLaunch } from '@tarojs/taro'
|
import { useLaunch } from '@tarojs/taro'
|
||||||
|
import 'taro-ui/dist/style/index.scss'
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
|
|
||||||
function App({ children }: PropsWithChildren<any>) {
|
function App({ children }: PropsWithChildren<any>) {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,25 @@
|
||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
import { useLoad } from '@tarojs/taro'
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
import { Component, ReactNode } from 'react'
|
||||||
|
|
||||||
export default function Index() {
|
class Index extends Component {
|
||||||
|
state = {
|
||||||
|
msg: "Hello World!"
|
||||||
|
}
|
||||||
|
|
||||||
useLoad(() => {
|
onReady() {
|
||||||
console.log('Page loaded.')
|
console.log("Index is ready");
|
||||||
})
|
}
|
||||||
|
|
||||||
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View className='index'>
|
<View>
|
||||||
<Text>Hello world!</Text>
|
<Text>
|
||||||
|
{this.state.msg}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Index
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue