Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:#1 ssr不生效停止开发 #5

Merged
merged 3 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Components/default/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<header>
<Navbar/>
</header>
</template>

<script lang="ts">
import Navbar from "~/Components/default/Navbar.vue";

export default {
name: "Header",
components: {Navbar}
}
</script>

<style scoped>

</style>
39 changes: 39 additions & 0 deletions Components/default/HomePostList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div>
Data begin
{{ data }}
Data end

<h1>
<NuxtLink to="/post">
测试详情页面
</NuxtLink>
</h1>
</div>
</template>

<script lang="ts" setup>
import logUtil from "~/lib/logUtil";
import {SERVER_API_CONSTANTS} from "~/lib/constants/serverApiConstants";

const route = useRoute()

const homePostsUrl = route.query.t ? SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + "?t=" + route.query.t :
SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS
const {data} = await useFetch(homePostsUrl)
logUtil.logInfo(SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + " data=>", data.value)

// definePageMeta({
// layout: "custom",
// });
</script>

<script lang="ts">
export default {
name: "HomePostList"
}
</script>

<style scoped>

</style>
49 changes: 49 additions & 0 deletions Components/default/Navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<ClientOnly>

<el-menu
:default-active="activeIndex"
class="el-menu-demo"
mode="horizontal"
@select="handleSelect"
>
<el-menu-item index="1">Processing Center</el-menu-item>
<el-sub-menu index="2">
<template #title>Workspace</template>
<el-menu-item index="2-1">item one</el-menu-item>
<el-menu-item index="2-2">item two</el-menu-item>
<el-menu-item index="2-3">item three</el-menu-item>
<el-sub-menu index="2-4">
<template #title>item four</template>
<el-menu-item index="2-4-1">item one</el-menu-item>
<el-menu-item index="2-4-2">item two</el-menu-item>
<el-menu-item index="2-4-3">item three</el-menu-item>
</el-sub-menu>
</el-sub-menu>
<el-menu-item index="3" disabled>Info</el-menu-item>
<el-menu-item index="4">Orders</el-menu-item>
</el-menu>
</ClientOnly>
<div class="h-6"/>
</template>

<script lang="ts" setup>
import {ref} from 'vue'

const activeIndex = ref('1')
const activeIndex2 = ref('1')
const handleSelect = (key: string, keyPath: string[]) => {
console.log(key, keyPath)
}
</script>

<script lang="ts">

export default {
name: "Navbar",
}
</script>

<style scoped>

</style>
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,31 @@ Next version for jvue-front using [nuxt3](https://github.com/nuxt/framework) whi

We will start develop after Nuxt3 **stabe** release,please wait...

## build
See also:[https://github.com/element-plus/element-plus-nuxt-starter/issues/46](https://github.com/element-plus/element-plus-nuxt-starter/issues/46)

## Install
```bash
dnf install npm
npm i -g yarn
npm i -g vercel
npm i -g pm2
```
## Init
```bash
yarn
```

## dev

```bash
vercel dev
```

## deploy
```bash
pm2 start pm2.json
```

```bash
pm2 stop pm2.json
```
6 changes: 0 additions & 6 deletions layouts/custom.vue

This file was deleted.

10 changes: 8 additions & 2 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<div>
A *default* layout
<Header/>
<slot/>
</div>
</template>
</template>
<script>
import Header from "../Components/default/Header";
export default {
components: {Header}
}
</script>
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export default defineNuxtConfig({
CONF_API_URL: process.env.CONF_API_URL,
CONF_USERNAME: process.env.CONF_USERNAME,
CONF_PASSWORD: process.env.CONF_PASSWORD
},
}
})
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"vdev": "vercel dev"
"vdev": "vercel dev --listen 3000"
},
"devDependencies": {
"@types/showdown": "^2.0.0",
"@types/xmlrpc": "^1.3.7",
"nuxt": "3.0.0-rc.8"
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.9",
"arraybuffer-xml-parser": "^0.6.0",
"element-plus": "^2.2.15",
"showdown": "^2.1.0",
"xmlrpc": "^1.3.2"
}
Expand Down
46 changes: 20 additions & 26 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
<template>
<div>
Data begin
{{ data }}
Data end

<h1>
<NuxtLink to="/post">
测试详情页面
</NuxtLink>
</h1>
<NuxtWelcome/>
</div>
<HomePostList/>
</template>

<script lang="ts" setup>
import logUtil from "~/lib/logUtil";
import {SERVER_API_CONSTANTS} from "~/lib/constants/serverApiConstants";

const route = useRoute()

const homePostsUrl = route.query.t ? SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + "?t=" + route.query.t :
SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS
const {data} = await useFetch(homePostsUrl)
logUtil.logInfo(SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + " data=>", data.value)

definePageMeta({
layout: "custom",
});
useHead({
title: 'My App',
// or, instead:
// titleTemplate: (title) => `My App - ${title}`,
viewport: 'width=device-width, initial-scale=1, maximum-scale=1',
charset: 'utf-8',
meta: [
{name: 'keywords', content: 'site,app,vercel'},
{name: 'description', content: 'My amazing site.'}
],
bodyAttrs: {
class: 'jvue-index-body'
}
})
</script>

<script lang="ts">

import HomePostList from "~/Components/default/HomePostList.vue";

export default {
name: "index"
name: "index",
components: {HomePostList}
}
</script>

Expand Down
11 changes: 11 additions & 0 deletions pm2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"apps": [
{
"name": "jvue-from",
"script": "yarn",
"args" : "vdev",
"instances": "max",
"exec_mode": "cluster"
}
]
}
Loading