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

create single page app demo #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ const htmlPluginOpt = {
}

const pageConfig = getVueConfig()

function getEntries () {
return pageConfig.entries
}

function setMultipagePlugin (mode = process.env.NODE_ENV) {
const webpackConfig = {
plugins: []
Expand Down
19 changes: 0 additions & 19 deletions public/admin.html

This file was deleted.

2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>hello-world</title>
</head>

<body>
Expand Down
13 changes: 2 additions & 11 deletions src/views/admin/App.vue → src/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<template>
<div id="app">
<img-show :src="logo" alt="LOGO" />
<hello name="admin"/>
<hello name="index"/>
</div>
</template>

<script>
import Hello from '@/components/Hello'
import ImgShow from './components/ImgShow'
import logo from '@/assets/logo.png'

export default {
name: 'App',
components: {
Hello,
ImgShow
},
data () {
return {
logo
}
Hello
}
}
</script>
Expand Down
26 changes: 0 additions & 26 deletions src/components/Hello.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
<div class="hello">
<h1 class="color-blue">Hello, {{ name }}</h1>
<h2 class="color-green">{{ msg }}</h2>
<h3>Project examples</h3>
<ul>
<li>
<a
:href="routeConfig.url"
target="_blank"
>
{{routeConfig.label}}
</a>
</li>
</ul>
</div>
</template>

Expand All @@ -24,21 +13,6 @@ export default {
return {
msg: 'Welcome to Your Vue.js App'
}
},
computed: {
routeConfig () {
const pathArr = window.location.pathname.split('/')
// eslint-disable-next-line
const [ path, ...prefix ] = pathArr.reverse()
const map = {
admin: 'index',
index: 'admin'
}
return {
url: `${prefix.join('/')}/${map[this.name]}.html`,
label: `跳转到${map[this.name]}`
}
}
}
}
</script>
Expand Down
File renamed without changes.
18 changes: 0 additions & 18 deletions src/views/admin/components/ImgShow.vue

This file was deleted.

57 changes: 0 additions & 57 deletions src/views/index/App.vue

This file was deleted.

51 changes: 0 additions & 51 deletions src/views/index/components/TableShow.vue

This file was deleted.

13 changes: 0 additions & 13 deletions src/views/index/main.js

This file was deleted.

22 changes: 0 additions & 22 deletions vue.config.js

This file was deleted.