Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
williamyorkl authored and williamyorkl committed Aug 18, 2021
1 parent 02b42f6 commit 2f91236
Show file tree
Hide file tree
Showing 9 changed files with 2,001 additions and 0 deletions.
12 changes: 12 additions & 0 deletions example/vue2/index.html
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>
1,872 changes: 1,872 additions & 0 deletions example/vue2/package-lock.json

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions example/vue2/package.json
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": ""
}
25 changes: 25 additions & 0 deletions example/vue2/src/App.vue
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>
22 changes: 22 additions & 0 deletions example/vue2/src/components/ComponentA.vue
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>
8 changes: 8 additions & 0 deletions example/vue2/src/components/News.vue
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>
9 changes: 9 additions & 0 deletions example/vue2/src/main.js
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)
})
19 changes: 19 additions & 0 deletions example/vue2/src/router/index.js
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
})
11 changes: 11 additions & 0 deletions example/vue2/vite.config.js
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

0 comments on commit 2f91236

Please sign in to comment.