GithubHelp home page GithubHelp logo

laiyongqin / tencent-ke Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blackwingss/tencent-ke

0.0 1.0 0.0 92 KB

vue起手式还原腾讯课堂(Web版)

JavaScript 17.93% HTML 0.32% Vue 81.75%

tencent-ke's Introduction

Vue2.0全家桶仿腾讯课堂(移动端)

描述

前端部分

  • SPA单页应用,webpack build to dist
  • 移动设备兼容:使用flexible.js和rem处理兼容问题
  • Vue Router 处理路由,vue的单页面应用是基于路由和组件的,路由用于设定访问路径,并将路径和组件映射起来
  • axios做ajax请求
  • element-UI完成构建轮播图等组件

后端部分

  • mock模拟数据好看又好用的模拟数据的平台
  • express 做静态资源目录

待更新的功能

  • 处理数据相关性,让课程和课程组件对应显示
  • 改用 express 抛接口
  • 用 express + mongodb 保存用户状态
  • 使用 Vuex 管理组件间的状态,实现非父子组件之间的通信

具体功能实现

路由结构

传统的页面应用,是用一些超链接来实现页面切换和跳转的。vue-router单页面应用中,则是路径之间的切换,也就是组件的切换。 我们创建一个 router,传入的 routes 中的每一项即为一条路由(route)配置,表示在匹配给定的地址时,应该使用什么组件渲染视图。

routes: [
    {
      path: '/',
      name: 'Index',
      component: Index
    },
    {
      path: '/Classification',
      name: 'Classification',
      component: Classification,
      children: [
        {
          path: 'ITList',
          name: 'ITList',
          component: ITList
        },
        {
          path: 'DesignList',
          name: 'DesignList',
          component: DesignList
        },
        {
          path: 'LanguageList',
          name: 'LanguageList',
          component: LanguageList
        },
        {
          path: 'ProfessionList',
          name: 'ProfessionList',
          component: ProfessionList
        },
        {
          path: 'ExamList',
          name: 'ExamList',
          component: ExamList
        },
        {
          path: 'InterestList',
          name: 'InterestList',
          component: InterestList
        }
      ]
    }]

Vuex的使用

Vuex 的状态存储是响应式的。当 Vue 组件从 store 中读取状态的时候,若 store 中的状态发生变化,那么相应的组件也会相应地得到高效更新。

需要注意: Action 类似于 mutation,不同在于: Action 提交的是 mutation,而不是直接变更状态。 Action 可以包含任意异步操作。

使用

npm install

npm run dev

tencent-ke's People

Contributors

blackwingss avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.