Top Related Projects
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
A Vue.js 2.0 UI Toolkit for Web
A high quality UI Toolkit built on Vue.js 2.0
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
Vue3、Element Plus、typescript后台管理系统
Large single page application with 45 pages built on vue2 + vuex. 基于 vue2 + vuex 构建一个具有 45 个页面的大型单页面应用
Quick Overview
Vue2.0-taopiaopiao is a Vue.js-based project that replicates the functionality of the Taobao movie ticket booking system. It serves as a practical example of building a complex web application using Vue.js 2.0, demonstrating various features and best practices in Vue development.
Pros
- Provides a comprehensive example of a real-world Vue.js application
- Implements various Vue.js features, including components, routing, and state management
- Offers insights into building responsive and interactive user interfaces
- Serves as a valuable learning resource for Vue.js developers
Cons
- Based on an older version of Vue.js (2.0), which may not include the latest features and best practices
- Limited documentation and comments in English, which may pose challenges for non-Chinese speakers
- May require updates to work with the latest dependencies and Vue.js ecosystem
- Lacks comprehensive test coverage
Code Examples
- Vue component example:
<template>
<div class="movie-list">
<movie-item v-for="movie in movies" :key="movie.id" :movie="movie" />
</div>
</template>
<script>
import MovieItem from './MovieItem.vue'
export default {
components: {
MovieItem
},
data() {
return {
movies: []
}
},
created() {
// Fetch movies data
}
}
</script>
This code demonstrates a Vue component that renders a list of movies using a child component.
- Vue router configuration:
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from './views/Home.vue'
import MovieDetail from './views/MovieDetail.vue'
Vue.use(VueRouter)
const routes = [
{ path: '/', component: Home },
{ path: '/movie/:id', component: MovieDetail }
]
const router = new VueRouter({
routes
})
export default router
This code sets up the Vue router with two routes: home and movie detail.
- Vuex store example:
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
selectedSeats: []
},
mutations: {
addSeat(state, seat) {
state.selectedSeats.push(seat)
},
removeSeat(state, seat) {
const index = state.selectedSeats.indexOf(seat)
if (index > -1) {
state.selectedSeats.splice(index, 1)
}
}
}
})
This code creates a Vuex store to manage the state of selected seats in the ticket booking process.
Getting Started
To run the project locally:
-
Clone the repository:
git clone https://github.com/canfoo/vue2.0-taopiaopiao.git
-
Install dependencies:
cd vue2.0-taopiaopiao npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:8080
to view the application.
Competitor Comparisons
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
Pros of Vue
- Core Vue framework with extensive documentation and community support
- Flexible and scalable for large applications
- Regularly updated with new features and improvements
Cons of Vue
- Steeper learning curve for beginners
- More complex setup for advanced features
- Larger file size compared to minimal implementations
Code Comparison
Vue (core framework):
import Vue from 'vue'
import App from './App.vue'
new Vue({
render: h => h(App)
}).$mount('#app')
vue2.0-taopiaopiao (specific implementation):
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
const router = new VueRouter({routes})
Summary
Vue is a comprehensive framework suitable for various project sizes, offering extensive features and community support. vue2.0-taopiaopiao is a specific implementation of a movie ticket booking system using Vue 2.0, demonstrating a practical application of the framework.
While Vue provides more flexibility and scalability, it may be overkill for simpler projects. vue2.0-taopiaopiao offers a focused solution for a particular use case but may lack the broader applicability of the core Vue framework.
The code comparison shows that Vue's core setup is simpler, while vue2.0-taopiaopiao includes additional routing configuration, reflecting its more specific purpose.
A Vue.js 2.0 UI Toolkit for Web
Pros of element
- Comprehensive UI component library with extensive documentation
- Active development and large community support
- Designed for building complex enterprise-level applications
Cons of element
- Larger bundle size due to its extensive feature set
- Steeper learning curve for beginners
- Less flexibility for custom designs compared to building from scratch
Code comparison
element:
<el-button type="primary" @click="handleClick">Click me</el-button>
<el-input v-model="inputValue" placeholder="Enter text"></el-input>
<el-table :data="tableData">
<el-table-column prop="name" label="Name"></el-table-column>
<el-table-column prop="age" label="Age"></el-table-column>
</el-table>
vue2.0-taopiaopiao:
<div class="button" @click="handleClick">Click me</div>
<input v-model="inputValue" placeholder="Enter text">
<table>
<tr v-for="item in tableData" :key="item.id">
<td>{{ item.name }}</td>
<td>{{ item.age }}</td>
</tr>
</table>
The element code showcases pre-built components with built-in functionality, while vue2.0-taopiaopiao uses more basic HTML elements with custom styling and logic. element provides a more standardized and feature-rich approach, while vue2.0-taopiaopiao offers more flexibility for custom implementations.
A high quality UI Toolkit built on Vue.js 2.0
Pros of iview
- Comprehensive UI component library with a wide range of ready-to-use components
- Well-documented and actively maintained, with regular updates and bug fixes
- Supports both Vue 2 and Vue 3, providing flexibility for different project requirements
Cons of iview
- Larger bundle size due to the extensive component library, which may impact initial load times
- Steeper learning curve for developers unfamiliar with the iview ecosystem
- Less customizable compared to building components from scratch
Code Comparison
iview:
<template>
<Button type="primary" @click="handleClick">Click me</Button>
</template>
<script>
export default {
methods: {
handleClick() {
this.$Message.info('Button clicked');
}
}
}
</script>
vue2.0-taopiaopiao:
<template>
<div class="button" @click="handleClick">Click me</div>
</template>
<script>
export default {
methods: {
handleClick() {
console.log('Button clicked');
}
}
}
</script>
The iview example showcases the use of pre-built components and integrated messaging system, while vue2.0-taopiaopiao demonstrates a more custom approach to building UI elements.
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
Pros of vue-element-admin
- More comprehensive and feature-rich, offering a complete admin panel solution
- Actively maintained with regular updates and a large community
- Extensive documentation and examples for easier implementation
Cons of vue-element-admin
- Steeper learning curve due to its complexity and extensive features
- Potentially overkill for smaller projects or simple admin interfaces
- Heavier bundle size, which may impact initial load times
Code Comparison
vue-element-admin:
import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layout'
Vue.use(Router)
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
}
]
vue2.0-taopiaopiao:
import Vue from 'vue'
import Router from 'vue-router'
import Movie from '../views/movie/movie.vue'
import Cinema from '../views/cinema/cinema.vue'
Vue.use(Router)
export default new Router({
routes: [
{ path: '/movie', component: Movie },
{ path: '/cinema', component: Cinema }
]
})
The code comparison shows that vue-element-admin uses a more modular approach with lazy-loading components, while vue2.0-taopiaopiao has a simpler router configuration. This reflects the overall complexity difference between the two projects.
Vue3、Element Plus、typescript后台管理系统
Pros of vue-manage-system
- More comprehensive and feature-rich admin template
- Regularly updated with newer Vue.js versions and dependencies
- Includes a variety of pre-built components and layouts
Cons of vue-manage-system
- Potentially more complex for beginners due to its extensive features
- May require more customization to fit specific project needs
- Larger codebase and potentially higher learning curve
Code Comparison
vue-manage-system:
<template>
<div class="header">
<div class="collapse-btn" @click="collapseChage">
<i v-if="!collapse" class="el-icon-s-fold"></i>
<i v-else class="el-icon-s-unfold"></i>
</div>
<div class="logo">后台管理系统</div>
<div class="header-right">
<div class="header-user-con">
<!-- User-related components -->
</div>
</div>
</div>
</template>
vue2.0-taopiaopiao:
<template>
<div id="app">
<v-header></v-header>
<router-view></router-view>
<v-footer></v-footer>
<v-loading v-show="loading"></v-loading>
<v-mask v-show="mask"></v-mask>
</div>
</template>
The code comparison shows that vue-manage-system has a more detailed and feature-rich header component, while vue2.0-taopiaopiao has a simpler overall app structure. This reflects the differences in complexity and focus between the two projects.
Large single page application with 45 pages built on vue2 + vuex. 基于 vue2 + vuex 构建一个具有 45 个页面的大型单页面应用
Pros of vue2-elm
- More comprehensive and feature-rich, covering a wider range of functionalities
- Better documentation and code organization, making it easier for developers to understand and contribute
- Includes a backend implementation, providing a full-stack solution
Cons of vue2-elm
- Larger codebase, which may be overwhelming for beginners or smaller projects
- More complex setup and configuration required
- Potentially slower initial load times due to the increased number of components and features
Code Comparison
vue2-elm:
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './router/router'
import store from './store/'
import {routerMode} from './config/env'
import './config/rem'
import FastClick from 'fastclick'
vue2.0-taopiaopiao:
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import store from './vuex/store'
import VueResource from 'vue-resource'
The code comparison shows that vue2-elm includes additional imports for configuration and performance optimization (FastClick), while vue2.0-taopiaopiao has a simpler setup with fewer dependencies.
Both projects use Vue.js 2.0 and implement routing and state management. However, vue2-elm appears to have a more extensive configuration and setup process, which aligns with its more comprehensive feature set.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
vue2.0ä¸expressæå»ºæ·ç¥¨ç¥¨é¡µé¢
reactæå»ºæ·ç¥¨ç¥¨ï¼è¯·ç¹å»è¿é
react-nativeæå»ºæ·ç¥¨ç¥¨ï¼è¯·ç¹å»è¿é
æè¿°
åè¿ä¸ªé¡¹ç®çç®ç䏿¯ä¸ºäºå¦ä¹ vue2.0ç¸å
³çç¥è¯ç¹ï¼äºæ¯ä¸ºäºç»ä»æ³è¦äºè§£vue2.0çç«¥éæä¾ä¸ä¸ªå¦ä¹ demoãæä»¥ä¸ºäºä½¿è¿ä¸ªé¡¹ç®æ´å 宿´ï¼é¡¹ç®ä¸å å
¥ä¸ä¸ªserveræå¡ï¼æ¨¡ææå¡å¨ç¯å¢ï¼ä¸ºå端æä¾æ°æ®æ¥æºï¼å½ç¨npm run deploy
å½ä»¤è¿è¡å端ç¯å¢æ¶ï¼å°±å¯ä»¥ç´æ¥å°åç«¯èµæºé¨ç½²å°serveræå¡éãå æ¤æ¬é¡¹ç®æä¸¤ä¸ªç¯å¢ï¼ä¸ä¸ªæ¯å端å¼åç¯å¢(ç«¯å£æ¯8080)ï¼ä¸ä¸ªæ¯serveræå¡ç¯å¢(ç«¯å£æ¯9090)ã
ä¸»è¦ææ¯æ ï¼
- vue2.0
- vue-router
- vuex
- mint-ui
- nodejs
- express
å¦ä½è¿è¡
ä¸è½½é¡¹ç®
git clone https://github.com/canfoo/vue2.0-taopiaopiao.git
æå¼ä¸ä¸ªç»ç«¯ï¼ç§°è¿ä¸ªç»ç«¯ä¸ºAç»ç«¯ï¼è¿å ¥å°vue2.0-taopiaopiaoç®å½å®è£ ä¾èµå
npm install
æå¼å¦ä¸ä¸ªä¸ä¸ªç»ç«¯ï¼ç§°è¿ä¸ªç»ç«¯ä¸ºBç»ç«¯ï¼è¿å ¥å°serverç®å½å®è£ ä¾èµå
npm install
å¯å¨serveræå¡ï¼å¾å å¯å¨åå°æå¡ï¼å¦ååç«¯é¡µé¢æ²¡ææ°æ®ï¼ï¼å¨serverç®å½ä¸æ§è¡ä»¥ä¸å½ä»¤ï¼æåæ§è¡ä¼ç»ç«¯ä¼æç¤ºæå¡ç«¯å£å·ä¸º9090
npm run start
å¯å¨å端å¼åæå¡ï¼å¨vue2.0-taopiaopiaoç®å½éæ§è¡ä»¥ä¸å½ä»¤ï¼æåæ§è¡åï¼ä¼èªå¨æå¼æµè§å¨è®¿é®å端å¼åç¯å¢ï¼æµè§å°åæ¯http://localhost:8080
npm run dev
åç«¯èµæºé¨ç½²å°serveréï¼å¼å宿åï¼å¨vue2.0-taopiaopiaoç®å½éæ§è¡ä»¥ä¸å½ä»¤ï¼æåæ§è¡åï¼å¯ä»¥éè¿è®¿é®serveræä¾çè·¯å¾è®¿é®å°é¡µé¢äºï¼è®¿é®è·¯å¾ä¸ºhttp://localhost:9090/app
npm run deploy
夿³¨ï¼å 为æ¬é¡¹ç®ææä¾åå°æå¡ï¼æä»¥å½å端é¨ç½²å°æå¡å¨åï¼åªè¦åå°æå¡å¯å¨ï¼å°±å¯ä»¥ç´æ¥éè¿http://localhost:9090/app
è·¯å¾è®¿é®å°å端页é¢ï¼æ é¡»åå¯å¨å端çå¼åæå¡ã
项ç®é¢è§
----------
----------
主è¦ç®å½ç»æ
build
config
src //å端主è¦å¼åç®å½
--assets //åæ¾å端éæèµæº
--components //åæ¾ç»ä»¶
--store //vuexæ°æ®æµç®¡ç
--views //页é¢è¯å¾ï¼ç±vue-routerå¼å ¥
--App.vue
--main.js //åç«¯å ¥å£æä»¶
server //åå°æå¡
--bin //å¯å¨åå°æå¡é ç½®
--database //忾页颿éè¦çjsonæ°æ®
--public //å端é¨ç½²æ¶åæ¾å¨åå°æå¡çä½ç½®
--routes //è·¯ç±äºè¯·æ±æ¥å£ç®¡ç
--views //å端模æ¿åæ¾ä½ç½®
--app.js //åå°æå¡å ¥å£
åå°æ¥å£
æ¬é¡¹ç®æ¯æå¨æåæ·ç¥¨ç¥¨é¨åæ°æ®ï¼æ°æ®æ¯16å¹´12æä»½çï¼å叿°æ®åªæåä¸å¹¿ææ°æ®ï¼å ¶å®åå¸é½æ¯éæºä»åä¸å¹¿æ°æ®æ½åè¿æ¥çï¼çµå½±æ°æ®ä¹æ¯é¨åææ°æ®ãæåçæ°æ®åæ¾å¨serverç®å½éçdatabaseéï¼ä¾å端è°ç¨ã
-
è®¿é®æ·ç¥¨ç¥¨é¦é¡µè·¯å¾ï¼
http://localhost:9090/app
-
é¨åæ°æ®æ¥å£
- è·åçæ æ°æ®
method: GET url: http://localhost:9090/movie/hot/?city=bj åæ°è¯´æ: cityå¯ä»¥ä¸ºbjãshãgz
- è·åå³å°ä¸æ æ°æ®
method: GET url: http://localhost:9090/movie/coming/?limit=20&offset=0 åæ°è¯´æ: limitä¸ºæ¯æ¬¡è¯·æ±çæ°æ®æ°éï¼offsetä¸ºæææ°æ®çåç§»é
- è·åå叿°æ®
method: GET url: http://localhost:9090/movie/city
- è·åçµå½±é¢æ°æ®
method: GET url: http://localhost:9090/movie/cinema/?city=bj åæ°è¯´æ: cityå¯ä»¥ä¸ºbjãshãgz
项ç®å客å°å
å¦æå¯¹é¡¹ç®æçæçå°æ¹ï¼è¯·å°http://www.cnblogs.com/canfoo/p/6214406.htmléçè¨ã妿è§å¾è¿ä¸ªé¡¹ç®å¯¹ä½ æå¸®å©çè¯ï¼è¯·Starä¸ä¸æ¬é¡¹ç®ï¼è¿æ¯å¯¹ä½è æå¤§çæ¯æã
Top Related Projects
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
A Vue.js 2.0 UI Toolkit for Web
A high quality UI Toolkit built on Vue.js 2.0
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
Vue3、Element Plus、typescript后台管理系统
Large single page application with 45 pages built on vue2 + vuex. 基于 vue2 + vuex 构建一个具有 45 个页面的大型单页面应用
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot