vue实现美观大方的动漫、cos、帖子类型网站
实现一个美观大款的动漫、cos、帖子类型网站,通常涉及到前端框架Vue.js的使用,以及后端数据的处理和部署。以下是一个简化版的Vue项目结构,展示了如何开始构建这样的网站。
my-anime-site/
|-- public/
| |-- index.html
|
|-- src/
| |-- assets/
| | |-- css/
| | | |-- global.css
| | |-- images/
| | | |-- bg.jpg
| | | |-- logo.png
| | |-- js/
| | |-- main.js
| |
| |-- components/
| | |-- Navbar.vue
| | |-- PostList.vue
| | |-- PostItem.vue
| | |-- Comments.vue
| | |-- Footer.vue
| |
| |-- App.vue
| |-- main.js
|
|-- .babelrc
|-- .eslintrc.js
|-- .gitignore
|-- package.json
|-- README.md
|-- vue.config.js
.babelrc
配置:
{
"presets": [
"@vue/cli-plugin-babel/preset"
]
}
.eslintrc.js
配置:
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
rules: {
// 自定义规则
},
parserOptions: {
parser: 'babel-eslint'
}
};
package.json
依赖:
{
"name": "my-anime-site",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-standard": "^5.1.2",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
}
}
vue.config.js
配置:
module.exports = {
// 配置项...
};
src/main.js
:
import Vue from 'vue';
import App from './App.vue';
new Vue({
render: h => h(App),
}).$mount('#app');
src/App.vue
:
<template>
<div id="app">
<navbar></navbar>
<post-list></post-list>
<comments></comments>
<footer-comp></footer-comp>
</div>
</template>
<script>
import Navbar from './components/Navbar.vue';
import PostList from './components/PostL
评论已关闭