Skip to content

Commit

Permalink
feat(基础代码架构): 项目基础代码初始化,目前只有vue 全家桶
Browse files Browse the repository at this point in the history
  • Loading branch information
白唯 committed Sep 3, 2020
1 parent d01b262 commit d4e8514
Show file tree
Hide file tree
Showing 39 changed files with 947 additions and 84 deletions.
7 changes: 7 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_ENV=development
// VUE_APP_BASE_URL = //10.10.10.115:8002
VUE_APP_BASE_URL = //apitest.cuidc.net
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
VUE_APP_EDITOR_JS = //editortest.cuidc.net
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
VUE_APP_EDITOR_URL_AUTH = a453964db52ff10ad0a3adf4be4dd4e5
6 changes: 6 additions & 0 deletions .env.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NODE_ENV=production
VUE_APP_BASE_URL = //apitest.cuidc.net
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
VUE_APP_EDITOR_JS = //editortest.cuidc.net
VUE_APP_EDITOR_URL_AUTH = 7f35b26c51e980153763ee996542f541
9 changes: 9 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NODE_ENV=production
VUE_APP_BASE_URL = //api.cuidc.net
VUE_APP_BASE_EDITOR_URL = //editorapi.cuidc.net
VUE_APP_EDITOR_JS = //editor.cuidc.net
VUE_APP_UPLOADED_URL = //bus-acc.cuidc.net/
VUE_APP_EDITOR_URL_AUTH = e3e5e9488f3e2e2857fc045b9c48566b



15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
es6: true
},
plugins: ['prettier', 'vue', '@typescript-eslint/eslint-plugin'],
rules: {
'prettier/prettier': 'error'
},
extends: ['standard', 'plugin:vue/essential', 'plugin:prettier/recommended']
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?

# local docs
todo-list.md
Empty file added .gitlab-ci.yml
Empty file.
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
printWidth: 999,
singleQuote: true,
semi: false,
trailingComma: 'none',
endOfLine: 'lf'
}
4 changes: 1 addition & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
presets: ['@vue/cli-plugin-babel/preset']
}
46 changes: 42 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint",
"commit": "npx cz"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0-0",
"vue-class-component": "^8.0.0-0",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.0-0"
"vuex": "^4.0.0-0",
"vuex-persistedstate": "^3.1.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0",
Expand All @@ -26,15 +28,23 @@
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/eslint-config-typescript": "^5.0.2",
"babel-eslint": "^10.1.0",
"commitizen": "^4.2.1",
"cz-conventional-changelog": "3.3.0",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0-0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"typescript": "~3.9.3"
"prettier": "^2.1.1",
"typescript": "~3.9.3",
"vue-property-decorator": "^9.0.0",
"vuex-persistedstate": "^3.1.0"
},
"eslintConfig": {
"root": true,
Expand All @@ -55,5 +65,33 @@
"> 1%",
"last 2 versions",
"not dead"
]
],
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog",
"disableScopeLowerCase": false,
"disableSubjectLowerCase": false,
"maxHeaderWidth": 100,
"maxLineWidth": 100,
"defaultType": "",
"defaultScope": "",
"defaultSubject": "",
"defaultBody": "",
"defaultIssues": "",
"types": {
"feat": {
"description": "新增功能",
"title": "新增"
},
"ci": {
"description": "部署相关",
"title": "CI/CD"
},
"fix": {
"description": "bug 修复",
"title": "修复"
}
}
}
}
}
21 changes: 15 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
<router-link to="/">Home</router-link> | <router-link to="/about">About</router-link>|
<router-link to="/contact">Contact</router-link>
</div>
<router-view/>
<router-view />
</div>
</template>

<style lang="less">
<script lang="ts">
import { defineComponent } from 'vue'
const App: any = defineComponent({
created() {
console.log('routerList', this.$route)
}
})
export default App
</script>

<style lang="less" scoped>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
Expand All @@ -19,11 +30,9 @@
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
Expand Down
17 changes: 17 additions & 0 deletions src/components/HelloWorld.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
h3 {
margin: 40px 0 0;
}

ul {
list-style-type: none;
padding : 0;
}

li {
display: inline-block;
margin : 0 10px;
}

a {
color: #42b983;
}
16 changes: 8 additions & 8 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
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>
Expand Down Expand Up @@ -34,16 +34,16 @@
</template>

<script lang="ts">
import { Options, Vue } from 'vue-class-component'
import { defineComponent } from 'vue'
@Options({
props: {
msg: String
const HelloWorld = defineComponent({
props: { msg: { type: String, default: '' } },
created() {
console.log(this.msg)
}
})
export default class HelloWorld extends Vue {
msg!: string
}
export default HelloWorld
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
Expand Down
24 changes: 24 additions & 0 deletions src/components/HelloWorld1.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<div>{{ author }}</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
const HelloWorld1 = defineComponent({
name: 'hello',
data() {
return {
pageName: 'About',
author: 'author'
}
},
methods: {
caculatePageName() {
this.pageName.split(',')
}
}
})
export default HelloWorld1
</script>
23 changes: 23 additions & 0 deletions src/components/SelfButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div><button>self-button</button></div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
const SlefButton = defineComponent({
name: 'SlefButton',
data() {
return {
pageName: 'About',
author: 'author'
}
},
methods: {
caculatePageName() {
this.pageName.split(',')
}
}
})
export default SlefButton
</script>
39 changes: 39 additions & 0 deletions src/components/TestDemo copy.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div ref="root" class="hello">
<p>{{ p }}</p>
</div>
</template>

<script lang="ts">
import './HelloWorld.css'
import { defineComponent, ref } from 'vue'
interface Prop {
name: string
}
const TestDemo = defineComponent({
name: 'TestDemo',
setup(props: Prop) {
const root = ref(null)
console.log(props)
const p = ref(33)
return {
p,
root
}
},
data() {
return {
pageName: 'About',
author: 'kk'
}
},
methods: {
caculatePageName() {
this.pageName.split(',')
}
}
})
export default TestDemo
</script>
23 changes: 23 additions & 0 deletions src/components/TestDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div>{{ author }}</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
const TestDemo = defineComponent({
name: 'TestDemo',
data() {
return {
pageName: 'About',
author: 'author'
}
},
methods: {
caculatePageName() {
this.pageName.split(',')
}
}
})
export default TestDemo
</script>
5 changes: 5 additions & 0 deletions src/config/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** 跟应用全局相关的静态配置放在这里 */
export default {
name: '12',
logo: '34'
}
4 changes: 4 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare interface Book {
author?: string
pageName: string
}
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import AppConfig from './config/app'

const app: any = createApp(App)
app.config.globalProperties = AppConfig
console.log('config', app.config)
createApp(App).use(store).use(router).mount('#app')
17 changes: 17 additions & 0 deletions src/router/about.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { RouteRecordRaw } from 'vue-router'

/** 关于我们页面的路由配置 */
const AboutRouter: RouteRecordRaw = {
path: '/about',
name: 'about',
component: () => import(/* webpackChunkName: "about" */ '@/views/About.vue'),
children: [
{
path: 'me',
name: 'aboutMe',
component: () => import(/* webpackChunkName: "about-me" */ '@/views/AboutMe.vue')
}
]
}

export default AboutRouter
Loading

0 comments on commit d4e8514

Please sign in to comment.