change to class
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { PropsWithChildren } from 'react'
|
||||
import { useLaunch } from '@tarojs/taro'
|
||||
import 'taro-ui/dist/style/index.scss'
|
||||
import './app.scss'
|
||||
|
||||
function App({ children }: PropsWithChildren<any>) {
|
||||
|
||||
+19
-10
@@ -1,16 +1,25 @@
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { useLoad } from '@tarojs/taro'
|
||||
import './index.scss'
|
||||
import { Component, ReactNode } from 'react'
|
||||
|
||||
export default function Index() {
|
||||
class Index extends Component {
|
||||
state = {
|
||||
msg: "Hello World!"
|
||||
}
|
||||
|
||||
useLoad(() => {
|
||||
console.log('Page loaded.')
|
||||
})
|
||||
onReady() {
|
||||
console.log("Index is ready");
|
||||
}
|
||||
|
||||
return (
|
||||
<View className='index'>
|
||||
<Text>Hello world!</Text>
|
||||
</View>
|
||||
)
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<Text>
|
||||
{this.state.msg}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Index
|
||||
|
||||
Reference in New Issue
Block a user