-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
williamyorkl
authored and
williamyorkl
committed
Aug 18, 2021
1 parent
02b42f6
commit 2f91236
Showing
9 changed files
with
2,001 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Vite App</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^7.0.3", | ||
"vite": "^2.2.4", | ||
"vite-plugin-vue2": "^1.5.1" | ||
}, | ||
"dependencies": { | ||
"vue-router": "3.5.2", | ||
"vue": "2.6.12", | ||
"vue-template-compiler": "2.6.12" | ||
}, | ||
"name": "vue2", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "ISC", | ||
"description": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div class="block"> | ||
<ComponentA msg="this is a A component" /> | ||
<router-view></router-view> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ComponentA from './components/ComponentA' | ||
export default { | ||
components:{ | ||
ComponentA | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.block { | ||
padding: 10px; | ||
margin: 20px; | ||
border: 1px solid rebeccapurple; | ||
border-radius: 15px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div> | ||
<h3>Component A: {{ msg }}</h3> | ||
<button @click="goNews">a button</button> | ||
<button @click="$router.go(-1)">返回</button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
msg: String, | ||
}, | ||
methods:{ | ||
goNews(){ | ||
this.$router.push({ | ||
path:'/news' | ||
}) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template> | ||
<div> | ||
this is a news page | ||
</div> | ||
</template> | ||
|
||
<script> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
|
||
new Vue({ | ||
el:'#app', | ||
router, | ||
render:(h) => h(App) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Vue from 'vue' | ||
import Router from 'vue-router' | ||
|
||
Vue.use(Router) | ||
|
||
const routerMap = [ | ||
{ | ||
path:'/news', | ||
component: () => import('../components/News') | ||
} | ||
] | ||
|
||
export default new Router({ | ||
scrollBehavior:() => ({ | ||
y:0, | ||
x:0 | ||
}), | ||
routes:routerMap | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { createVuePlugin } from 'vite-plugin-vue2' | ||
import VitePluginVue2Suffix from '../../src' | ||
|
||
const config = { | ||
plugins: [ | ||
createVuePlugin(), | ||
VitePluginVue2Suffix() | ||
] | ||
} | ||
|
||
export default config |