Top Related Projects
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
The library for web and native user interfaces.
Deliver web apps with confidence 🚀
Cybernetically enhanced web apps
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces
Quick Overview
Vue-cnode is a Vue.js-based implementation of the CNode community forum. It's a single-page application (SPA) that demonstrates how to build a full-featured web application using Vue.js, Vuex for state management, and Vue Router for navigation.
Pros
- Provides a comprehensive example of building a complex application with Vue.js
- Implements responsive design, making it mobile-friendly
- Uses Vuex for efficient state management across components
- Demonstrates integration with a real API (CNode)
Cons
- The project hasn't been updated recently, potentially using outdated dependencies
- Documentation is primarily in Chinese, which may be a barrier for non-Chinese speakers
- Lacks comprehensive unit tests
- May not follow the most recent Vue.js best practices due to its age
Code Examples
- Vuex store setup:
import Vue from 'vue'
import Vuex from 'vuex'
import user from './user'
import topics from './topics'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user,
topics
}
})
- Vue Router configuration:
import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from './component/index'
import Topic from './component/topic'
import User from './component/user'
Vue.use(VueRouter)
const router = new VueRouter({
routes: [
{ path: '/', component: Index },
{ path: '/topic/:id', component: Topic },
{ path: '/user/:loginname', component: User }
]
})
export default router
- API call example:
import axios from 'axios'
export default {
getTopics(params) {
return axios.get('https://cnodejs.org/api/v1/topics', { params })
},
getTopic(id) {
return axios.get(`https://cnodejs.org/api/v1/topic/${id}`)
}
}
Getting Started
To get started with vue-cnode:
-
Clone the repository:
git clone https://github.com/lzxb/vue-cnode.git
-
Install dependencies:
cd vue-cnode npm install
-
Run the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:8080
to see the application running.
Competitor Comparisons
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
Pros of Vue
- Much larger and more active community with over 200k stars on GitHub
- More comprehensive framework with official routing, state management, and tooling
- Extensively documented with official guides, API references, and examples
Cons of Vue
- Steeper learning curve due to more features and concepts to grasp
- Potentially overkill for smaller projects or simple applications
- Larger bundle size compared to minimal Vue implementations
Code Comparison
Vue (core template syntax):
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello Vue!'
}
}
}
</script>
vue-cnode (example component):
<template>
<div class="user">
<user-info :user="user"></user-info>
<user-topics :user="user"></user-topics>
</div>
</template>
<script>
export default {
name: 'user',
computed: {
user() {
return this.$store.state.user.view
}
}
}
</script>
Summary
Vue is a more comprehensive framework with a larger ecosystem, while vue-cnode is a specific implementation for the CNode community. Vue offers more features and flexibility but may be more complex, whereas vue-cnode is tailored for a particular use case and potentially simpler to use within its intended context.
The library for web and native user interfaces.
Pros of React
- Larger community and ecosystem, with more resources and third-party libraries
- More flexible and can be used for both web and mobile development
- Better performance for large-scale applications due to virtual DOM
Cons of React
- Steeper learning curve, especially for beginners
- Requires additional libraries for state management and routing
- More boilerplate code compared to Vue.js
Code Comparison
React component:
import React from 'react';
const MyComponent = ({ name }) => {
return <div>Hello, {name}!</div>;
};
export default MyComponent;
Vue-cnode component:
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
export default {
props: ['name']
}
</script>
Additional Notes
- React is a more comprehensive library, while vue-cnode is a specific implementation of Vue.js for the CNode community
- Vue-cnode is tailored for a specific use case, while React is more general-purpose
- React has a larger job market and more widespread adoption in enterprise environments
- Vue-cnode may be easier to set up and use for beginners or small projects
- Both projects are open-source and actively maintained, but React has more frequent updates and contributions
Deliver web apps with confidence 🚀
Pros of Angular
- More comprehensive framework with built-in features for large-scale applications
- Strong typing with TypeScript integration
- Extensive documentation and community support
Cons of Angular
- Steeper learning curve for beginners
- Heavier and more complex than Vue.js
- Requires more boilerplate code
Code Comparison
Angular component:
@Component({
selector: 'app-root',
template: `<h1>{{ title }}</h1>`
})
export class AppComponent {
title = 'Hello, Angular!';
}
vue-cnode component:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello, Vue!'
}
}
}
</script>
Summary
Angular is a more robust framework suitable for large-scale applications, offering strong typing and comprehensive features. However, it has a steeper learning curve and requires more boilerplate code. vue-cnode, being based on Vue.js, is lighter and easier to learn, making it more suitable for smaller projects or developers new to frontend frameworks. The code comparison shows that Angular uses TypeScript and decorators, while vue-cnode uses a more straightforward Vue.js component structure.
Cybernetically enhanced web apps
Pros of Svelte
- Smaller bundle sizes and faster runtime performance
- Simpler, more intuitive syntax with less boilerplate code
- Built-in reactivity without the need for a virtual DOM
Cons of Svelte
- Smaller ecosystem and community compared to Vue
- Fewer third-party libraries and components available
- Steeper learning curve for developers coming from traditional frameworks
Code Comparison
Svelte component:
<script>
let count = 0;
function increment() {
count += 1;
}
</script>
<button on:click={increment}>
Clicks: {count}
</button>
Vue-CNode component:
<template>
<button @click="increment">
Clicks: {{ count }}
</button>
</template>
<script>
export default {
data() {
return { count: 0 };
},
methods: {
increment() {
this.count += 1;
}
}
};
</script>
The Svelte code is more concise and requires less boilerplate. It uses a more straightforward approach to reactivity, while Vue-CNode follows Vue's traditional component structure with separate template and script sections.
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
Pros of Preact
- Smaller bundle size and faster performance due to its lightweight nature
- Closer to vanilla JavaScript, making it easier for developers familiar with JS
- Compatible with many React libraries and tools through aliases
Cons of Preact
- Smaller ecosystem compared to Vue, which vue-cnode leverages
- Less comprehensive documentation and community resources
- May require additional configuration for some React-specific features
Code Comparison
vue-cnode (Vue.js):
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello, Vue!'
}
}
}
</script>
Preact:
import { h, Component } from 'preact';
class App extends Component {
render() {
return <div>Hello, Preact!</div>;
}
}
Summary
Preact offers a lightweight alternative to React with similar syntax and compatibility, making it suitable for performance-critical applications. vue-cnode, built with Vue.js, benefits from Vue's extensive ecosystem and easier learning curve. Preact's code is more concise and closer to vanilla JavaScript, while vue-cnode follows Vue's template-based approach. The choice between them depends on project requirements, team expertise, and performance considerations.
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces
Pros of Inferno
- Higher performance and smaller bundle size than Vue-based projects
- More flexible and lightweight, allowing for greater customization
- Better suited for complex, high-performance applications
Cons of Inferno
- Smaller community and ecosystem compared to Vue
- Steeper learning curve, especially for developers familiar with Vue
- Less comprehensive documentation and fewer ready-made components
Code Comparison
Vue-cnode (Vue.js):
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello, Vue!'
}
}
}
</script>
Inferno:
import { render } from 'inferno';
function MyComponent({ message }) {
return <div>{message}</div>;
}
render(<MyComponent message="Hello, Inferno!" />, document.getElementById('app'));
The code comparison shows that Inferno uses a more React-like syntax with JSX, while Vue-cnode uses Vue's template and script structure. Inferno's approach is more JavaScript-centric, which can be advantageous for developers with strong JavaScript skills. However, Vue's template-based approach may be more intuitive for some developers, especially those new to frontend frameworks.
Inferno's performance benefits and smaller bundle size make it a strong choice for projects where these factors are crucial. However, Vue-cnode, being based on Vue.js, offers a gentler learning curve and a larger ecosystem, which can be beneficial for rapid development and community support.
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
æ¤é¡¹ç®é¤äºæ£å¸¸çbugä¿®å¤ï¼ä¸åè¿è¡åè½æ´æ°
å¦æ对ç¶æ管çæå ´è¶£ï¼å¯ä»¥çä¸ Tmsï¼ææ¡£æ´é½å ¨
åè¨
项ç®çµæçæåæ¥æºæ¯@shinygangæ¥èªçVue-cnodejsï¼ æè°¢cnodejs社åºæä¾çAPIã githubï¼https://github.com/lzxb/vue-cnode
ææ
å¨vue-cnodeå级vue2çæ¶åï¼å¨å
¬å¸å
é¨å·²ç»æ两个æ£å¼é¡¹ç®ä½¿ç¨vue2ï¼
éå°çä¸ä¸ªæé¾çé®é¢ï¼å°±æ¯å¦ä½è½å¨é¡µé¢åéæ¶è¿åæ°æ®åæ»å¨æ¡ä½ç½®ï¼
è½ç¶vue2å
ç½®äºkeep-aliveç»ä»¶ï¼vue-routerä¹æä¾äºscrollBehavioræ¹æ³è¿è¡è®¾ç½®ï¼
ä½æ¯ä»ç¶æ æ³æ»¡è¶³éæ±ï¼åæ¥é
读vue-routerçæºç åç°ï¼
æ¯ä¸ªé¡µé¢é½ä¼èªå¨å¨history.state对象ä¸åå¨ä¸ä¸ªå¯¹åºçkeyå¼ï¼
便å©ç¨è¿ä¸ªç¹æ§å®ç°äºé¡µé¢åéæ¶ï¼æ°æ®åæ»å¨æ¡è¿åï¼
ä¸è¿ç®ååªæ¯å®ç°äºé¡µé¢ç顶级ç»ä»¶è¿åï¼
å¦æéè¦å¯¹é¡¶çº§ç»ä»¶ä¸çåç»ä»¶å®ç°æ°æ®è¿åï¼
å¯ä»¥å©ç¨$options._scopeIdæ¥å®ç°ã
ååï¼å
·ä½å¦ä½å®ç°å°±è¦é 大家èªå·±åæ¥æ³è±¡åäº
ææ¯æ
åºäºvue2 + vue-router + vuet + ES6 + less + flex.csséåvueçcnode社åºï¼ä½¿ç¨webpackæå
使ç¨é¡¹ç®
1.å
é项ç®ï¼ git clone https://github.com/lzxb/vue-cnode.git
2.å®è£
nodejs
3.å®è£
ä¾èµï¼   npm install
4.å¯å¨æå¡ï¼ npm run dev
5.åå¸ä»£ç ï¼ Â Â npm run build
åè½
- é¦é¡µå表ï¼ä¸æå è½½
- 主é¢è¯¦æ ï¼åå¤ï¼ç¹èµ
- æ¶æ¯å表
- æ¶æ¯æé
- æ¶æ¯æ 记为已读
- 个人主页
- ç¨æ·ä¿¡æ¯
- ç»å½
- éåº
- å ³äº
- 页é¢åéï¼æ°æ®è¿å
- 页é¢åéï¼æ»å¨ä½ç½®è¿å
- ajax请æ±æ¦æªå¨
- 页é¢è·³è½¬ï¼ä¸åæ§è¡æ¤é¡µé¢çajax请æ±åè°æ¹æ³
- å¯å¨å¾
项ç®ç®å½è¯´æ
.
|-- config // 项ç®å¼åç¯å¢é
ç½®
| |-- index.js // 项ç®æå
é¨ç½²é
ç½®
|-- src // æºç ç®å½
| |-- components // å
Œ
±ç»ä»¶
|    |-- content.vue       // 页é¢å
容å
Œ
±ç»ä»¶
|    |-- data-null.vue      // æ°æ®ä¸ºç©ºæ¶å
Œ
±ç»ä»¶
|    |-- footer.vue        // åºé¨å¯¼èªæ å
Œ
±ç»ä»¶
|    |-- header.vue        // 页é¢å¤´é¨å
Œ
±ç»ä»¶
|    |-- index.js         // å è½½åç§å
Œ
±ç»ä»¶
|    |-- loading.vue        // 页é¢æ°æ®å è½½å
Œ
±ç»ä»¶
|  |-- config            // è·¯ç±é
ç½®åç¨åºçåºæ¬ä¿¡æ¯é
ç½®
|    |-- config.js        // é
置项ç®çåºæ¬ä¿¡æ¯
|    |-- routes.js        // é
置页é¢è·¯ç±
| |-- css // åç§cssæ件
| |-- common.css // å
¨å±éç¨cssæ件
| |-- iconfont // åç§åä½å¾æ
| |-- images // å
Œ
±å¾ç
| |-- less // åç§lessæ件
| |-- common.less // å
¨å±éç¨lessæ件
|    |-- config.less       // å
¨å±éç¨lessé
ç½®æ件
|  |-- lib            // åç§æ件
|    |-- route-data       // å®ç°é¡µé¢åéæ°æ®è¿åï¼æ»å¨ä½ç½®è¿å
|  |-- mixins            // åç§å
¨å±mixins
|    |-- pull-list.js       // ä¸æå è½½
| |-- pages // åç§é¡µé¢ç»ä»¶
| |-- about // å
³äº
| |-- index // é¦é¡µ
| |-- login // ç»å½
| |-- my // æç主页ï¼åæ¶æ¯å表
| |-- signout // éåº
| |-- topic // 主é¢è¯¦æ
ï¼ä¸»é¢æ°å»º
| |-- user // æ¥çç¨æ·èµæ
| |-- store // vuexçç¶æ管ç
| |-- index.js // å è½½åç§store模å
| |-- user.js // ç¨æ·store
| |-- template // åç§htmlæ件
| |-- index.html // ç¨åºå
¥å£htmlæ件
| |-- utils // å
Œ
±çjsæ¹æ³
| |-- app.vue // 页é¢å
¥å£æ件
| |-- main.js // ç¨åºå
¥å£æ件ï¼å è½½åç§å
Œ
±ç»ä»¶
|-- .babelrc // ES6è¯æ³ç¼è¯é
ç½®
|-- webpack.config.js // ç¨åºæå
é
ç½®
|-- server.js // å¼åæ¶ä½¿ç¨çæå¡å¨
|-- README.md // 项ç®è¯´æ
|-- package.json // é
置项ç®ç¸å
³ä¿¡æ¯ï¼éè¿æ§è¡ npm init å½ä»¤å建
.
æ«ä¸æ«äºç»´ç æ¥çææ
Top Related Projects
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
The library for web and native user interfaces.
Deliver web apps with confidence 🚀
Cybernetically enhanced web apps
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces
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