基础模块搭建

This commit is contained in:
灌糖包子 2021-12-10 22:19:14 +08:00
parent b993cb54e4
commit 3563c6f4f2
9 changed files with 1986 additions and 1944 deletions

View File

@ -3,12 +3,16 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.22.0",
"core-js": "^3.6.5",
"vue": "^3.0.0"
"vue": "^3.2.16",
"vue-axios": "^3.3.7",
"vue-router": "^4.0.11",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",

View File

@ -1,26 +1,12 @@
<template>
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<router-view></router-view>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

View File

@ -1,57 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@ -1,4 +1,17 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
createApp(App).mount('#app')
import VueAxios from 'vue-axios'
import axios from 'axios'
// 配置默认axios参数
const service = axios.create({
timeout: 10000
})
createApp(App)
.use(router)
.use(store)
.use(VueAxios, service)
.mount('#app')

12
src/router.js Normal file
View File

@ -0,0 +1,12 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import Guide from '@/views/Guide.vue'
const routes = [
{ path: '/', name: 'Guide', component: Guide },
]
export default createRouter({
history: createWebHashHistory(),
routes
})

8
src/store.js Normal file
View File

@ -0,0 +1,8 @@
import { createStore } from 'vuex'
export default createStore({
state: {
},
mutations: {
}
})

16
src/views/Guide.vue Normal file
View File

@ -0,0 +1,16 @@
<template>
<div>这里是引导页面</div>
</template>
<script>
export default {
async created() {
const result = await this.$http.get('/api/rainbow_card/card/types')
console.log(result)
}
}
</script>
<style>
</style>

29
vue.config.js Normal file
View File

@ -0,0 +1,29 @@
const path = require('path')
module.exports = {
publicPath: './',
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html',
title: '彩虹卡',
},
},
configureWebpack: {
resolve: {
alias: {
'@': path.resolve(__dirname, "./src"),
},
},
},
devServer: {
proxy: {
'^/api': {
// target: 'http://localhost:8091'
target: 'https://www.colorfulsweet.site',
changeOrigin: true
}
}
},
}

3769
yarn.lock

File diff suppressed because it is too large Load Diff