create-packer 1.41.4 → 1.41.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +10 -17
- package/template/web-app/react-rsbuild/package.json +0 -1
- package/template/web-app/react-rsbuild/pages/home/view.tsx +11 -10
- package/template/web-app/react-rsbuild/shared/service/home.ts +7 -8
- package/template/web-app/react-vite/domain/app/components/app-context.tsx +3 -10
- package/template/web-app/react-vite/package.json +0 -1
- package/template/web-app/react-vite/pages/home/view.tsx +11 -10
- package/template/web-app/react-vite/shared/service/home.ts +7 -10
- package/template/web-app/vue/main.ts +1 -1
- package/template/web-app/vue/package.json +0 -1
- package/template/web-app/vue/pages/home/view.vue +12 -16
- package/template/web-app/vue/shared/service/home.ts +3 -6
- package/template/web-app/vue-rsbuild/main.ts +1 -2
- package/template/web-app/vue-rsbuild/package.json +0 -1
- package/template/web-app/vue-rsbuild/pages/home/view.mock.ts +19 -0
- package/template/web-app/vue-rsbuild/pages/home/view.vue +12 -16
- package/template/web-app/vue-rsbuild/shared/hooks/useList.ts +3 -3
- package/template/web-app/vue-rsbuild/shared/service/home.ts +3 -6
package/package.json
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react'
|
|
2
|
-
import { ThemeProvider } from 'styled-components'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export const Root: FunctionComponent<propsType> = props => {
|
|
12
|
-
return (
|
|
13
|
-
<QueryClientProvider client={queryClient}>
|
|
14
|
-
<ThemeProvider theme={theme}>{props.children}</ThemeProvider>
|
|
15
|
-
</QueryClientProvider>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
+
import { ThemeProvider } from 'styled-components'
|
|
3
|
+
import { theme } from '@/shared/theme'
|
|
4
|
+
|
|
5
|
+
export interface propsType {
|
|
6
|
+
children: ReactNode
|
|
7
|
+
}
|
|
8
|
+
export const Root: FunctionComponent<propsType> = props => {
|
|
9
|
+
return <ThemeProvider theme={theme}>{props.children}</ThemeProvider>
|
|
10
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useAsync } from 'react-use'
|
|
2
|
+
import { fetchHomeData } from '@/shared/service'
|
|
3
|
+
import { StyledRoot } from './view.styled'
|
|
4
|
+
|
|
5
|
+
export default function Home() {
|
|
6
|
+
const homeData = useAsync(fetchHomeData)
|
|
7
|
+
|
|
8
|
+
console.log('data', homeData.value)
|
|
9
|
+
|
|
10
|
+
return <StyledRoot>sdfs</StyledRoot>
|
|
11
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { request } from './request'
|
|
2
|
+
import { HOME_DATA } from './api'
|
|
3
|
+
|
|
4
|
+
export async function fetchHomeData() {
|
|
5
|
+
const { data } = await request(HOME_DATA)
|
|
6
|
+
return data
|
|
7
|
+
}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react'
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react'
|
|
2
2
|
import { ThemeProvider } from 'styled-components'
|
|
3
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
4
3
|
import { theme } from '@/shared/theme'
|
|
5
4
|
|
|
6
|
-
const queryClient = new QueryClient()
|
|
7
|
-
|
|
8
5
|
export interface propsType {
|
|
9
|
-
children:
|
|
6
|
+
children: ReactNode
|
|
10
7
|
}
|
|
11
8
|
export const Root: FunctionComponent<propsType> = props => {
|
|
12
|
-
return
|
|
13
|
-
<QueryClientProvider client={queryClient}>
|
|
14
|
-
<ThemeProvider theme={theme}>{props.children}</ThemeProvider>
|
|
15
|
-
</QueryClientProvider>
|
|
16
|
-
)
|
|
9
|
+
return <ThemeProvider theme={theme}>{props.children}</ThemeProvider>
|
|
17
10
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useAsync } from 'react-use'
|
|
2
|
+
import { fetchHomeData } from '@/shared/service'
|
|
3
|
+
import { StyledRoot } from './view.styled'
|
|
4
|
+
|
|
5
|
+
export default function Home() {
|
|
6
|
+
const homeData = useAsync(fetchHomeData)
|
|
7
|
+
|
|
8
|
+
console.log('data', homeData.value)
|
|
9
|
+
|
|
10
|
+
return <StyledRoot>sdfs</StyledRoot>
|
|
11
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
queryFn: () => request.post(HOME_DATA)
|
|
9
|
-
})
|
|
10
|
-
}
|
|
1
|
+
import { request } from './request'
|
|
2
|
+
import { HOME_DATA } from './api'
|
|
3
|
+
|
|
4
|
+
export async function fetchHomeData() {
|
|
5
|
+
const { data } = await request(HOME_DATA)
|
|
6
|
+
return data
|
|
7
|
+
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
<div>Home</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style scoped></style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { fetchHomeData } from '@/shared/service'
|
|
3
|
+
|
|
4
|
+
const data = fetchHomeData()
|
|
5
|
+
console.log('data', data)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div>Home</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<style scoped></style>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/vue-query'
|
|
2
1
|
import { request } from './request'
|
|
3
2
|
import { HOME_DATA } from './api'
|
|
4
3
|
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
queryFn: () => request.post(HOME_DATA)
|
|
9
|
-
})
|
|
4
|
+
export async function fetchHomeData() {
|
|
5
|
+
const { data } = await request(HOME_DATA)
|
|
6
|
+
return data
|
|
10
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createPinia } from 'pinia'
|
|
2
|
-
import { VueQueryPlugin } from '@tanstack/vue-query'
|
|
3
2
|
import { router } from '@/router'
|
|
4
3
|
import { app } from '@/domain/app'
|
|
5
4
|
import './style.css'
|
|
6
5
|
|
|
7
|
-
app.use(
|
|
6
|
+
app.use(createPinia()).use(router).mount('#app')
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
|
+
import { defineMock } from '@/mockUtils'
|
|
3
|
+
import { API } from '@/shared/service'
|
|
4
|
+
|
|
5
|
+
export default defineMock([
|
|
6
|
+
{
|
|
7
|
+
url: API.HOME_DATA,
|
|
8
|
+
body: faker.helpers.multiple(
|
|
9
|
+
() => ({
|
|
10
|
+
id: faker.string.uuid(),
|
|
11
|
+
name: faker.person.fullName(),
|
|
12
|
+
age: faker.number.int({ max: 110 })
|
|
13
|
+
}),
|
|
14
|
+
{
|
|
15
|
+
count: 10
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
])
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
<div>Home</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style scoped></style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { fetchHomeData } from '@/shared/service'
|
|
3
|
+
|
|
4
|
+
const data = fetchHomeData()
|
|
5
|
+
console.log('data', data)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div>Home</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<style scoped></style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, reactive, computed, unref } from 'vue'
|
|
2
|
-
import { cloneDeep, concat, assign, pick, isNil, size, max } from 'lodash-es'
|
|
2
|
+
import { cloneDeep, concat, assign, pick, isNil, size, map, max } from 'lodash-es'
|
|
3
3
|
|
|
4
4
|
export interface stateType<ListItem, P> {
|
|
5
5
|
loading: boolean
|
|
@@ -73,9 +73,9 @@ export default function createListStore<
|
|
|
73
73
|
assign(params, arg?.params)
|
|
74
74
|
const result = await config.fetch({
|
|
75
75
|
pagination: unref(pagination),
|
|
76
|
-
selected: unref(selected)
|
|
76
|
+
selected: unref(selected),
|
|
77
77
|
total: unref(total),
|
|
78
|
-
params
|
|
78
|
+
params
|
|
79
79
|
})
|
|
80
80
|
list.value =
|
|
81
81
|
!isNil(result.page) && arg?.isConcat ? concat(list.value, result.list) : result.list
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/vue-query'
|
|
2
1
|
import { request } from './request'
|
|
3
2
|
import { HOME_DATA } from './api'
|
|
4
3
|
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
queryFn: () => request.post(HOME_DATA)
|
|
9
|
-
})
|
|
4
|
+
export async function fetchHomeData() {
|
|
5
|
+
const { data } = await request(HOME_DATA)
|
|
6
|
+
return data
|
|
10
7
|
}
|