feat(directory): add layout scaffold
This commit is contained in:
@@ -1,20 +1,28 @@
|
||||
import {
|
||||
useState,
|
||||
useEffect
|
||||
useEffect,
|
||||
useContext
|
||||
} from 'react'
|
||||
import './home.css'
|
||||
import { TitleContext } from '@/context/useTitleContext';
|
||||
|
||||
export default function Home(props) {
|
||||
const { title, setTitle } = useContext(TitleContext)
|
||||
useEffect(() => {
|
||||
fetch("/_assets/directory.json").then(res => res.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setTitle('dynamic_compile')
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
1233
|
||||
{title}
|
||||
<button onClick={() => setTitle('123')}>123</button>
|
||||
</section>
|
||||
<section>
|
||||
22s
|
||||
|
||||
0
directory/src/routes/path/news.css
Normal file
0
directory/src/routes/path/news.css
Normal file
27
directory/src/routes/path/news.jsx
Normal file
27
directory/src/routes/path/news.jsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
useState,
|
||||
useEffect,
|
||||
useContext
|
||||
} from 'react'
|
||||
import './news.css'
|
||||
import { TitleContext } from '@/context/useTitleContext';
|
||||
|
||||
export default function News(props) {
|
||||
const { title, setTitle } = useContext(TitleContext)
|
||||
|
||||
useEffect(() => {
|
||||
setTitle('news')
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
1
|
||||
<button onClick={() => setTitle('123')}>123</button>
|
||||
</section>
|
||||
<section>
|
||||
2
|
||||
</section>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -1,15 +1,23 @@
|
||||
import {
|
||||
useState,
|
||||
useEffect
|
||||
useEffect,
|
||||
useContext
|
||||
} from 'react'
|
||||
import './operator.css'
|
||||
import { TitleContext } from '@/context/useTitleContext';
|
||||
|
||||
export default function Operator(props) {
|
||||
const { title, setTitle } = useContext(TitleContext)
|
||||
|
||||
useEffect(() => {
|
||||
setTitle('Chen')
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section>
|
||||
1
|
||||
<button onClick={() => setTitle('123')}>123</button>
|
||||
</section>
|
||||
<section>
|
||||
2
|
||||
|
||||
Reference in New Issue
Block a user