GithubHelp home page GithubHelp logo

hhy5277 / toutiao_vue2.0 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mino01x/toutiao_vue2.0

0.0 1.0 0.0 9.01 MB

基于Vue2.0全家桶的低配版今日头条

Home Page: https://huahua-chen.github.io/demos/toutiao

JavaScript 41.82% HTML 0.76% Vue 51.92% CSS 5.50%

toutiao_vue2.0's Introduction

toutiao

基于Vue2.0仿照今日头条的移动端项目

源码地址:toutiao_Vue2.0

预览地址:toutiao_Vue2.0

前言

先占个坑位。

之前打算做个东西熟悉vue的使用,由于自己蛮喜欢刷手机看看新闻的,借鉴了其他同学的项目(链接在下面),自己也做了一个。项目中还有许多可以完善的地方,不足之处希望小伙伴们可以issue,我会在这里更新。目前还没有全面地测试该项目,有问题提问,大家一起学习。

技术栈

  1. 主要用到:vue、vuex、vue-router
  2. 移动端布局:flexble.js
  3. 其他: jsonp、axios、iView、vue-lazyload、moment

功能

  • 各类新闻的查看
  • 本地收藏新闻
  • 新闻的搜索
  • 待...

效果

移动端

移动端可以直接扫描,或者在chrome的device toolbard打开传送门

entry

collect

search

目录

|- src
   |- assets
      |- image                   // 项目图片
      |- style
         |- common.scss          // 移动端的单位的转换
         |- global.scss          // 全局样式
         |- newsList.scss        // 新闻列表的样式
         |- transition.scss      // 过渡样式
   |- components                 // 组件
      |- Back.vue                // 返回
      |- Comment.vue             // 评论
      |- Footer.vue              // 页脚
      |- HomeNav.vue             // 新闻类型导航
      |- Loading.vue             // 加载
      |- Loadingmore.vue         // 加载更多
      |- Nav.vue                 // 导航
      |- Newslist.vue            // 新闻列表
      |- Top.vue                 // 返回顶部
      |- Warning.vue             // 出错提醒
   |- pages                      // 主体页面
      |- About.vue               // 信息页
      |- Collect.vue             // 收藏页
      |- Content.vue             // 文章页
      |- Home.vue                // 主页
      |- Search.vue              // 收藏页
      |- Session.vue             // 段子页
   |- router                     // 路由
   |- store                      // 状态管理
   |- App.vue
   |- main.js                    // 入口文件
|- static
   |- collect.json               // 初始收藏
   |- imgerror.jpg               // 懒加载错误图片
   |- imgloading.jpg             // 懒加载中图片

更多细节在源码中会有一些注释

API

  1. 获取新闻:https://m.toutiao.com/list/?tag=新闻类型&ac=wap&count=20&format=json_raw&as=A125A8CEDCF8987&cp=58EC18F948F79E1&min_behot_time=时间

  2. 获取文章:https://m.toutiao.com/i新闻ID/info/'

  3. 获取段子:https://www.toutiao.com/api/article/feed/?category=essay_joke&utm_source=toutiao&widen=1&max_behot_time=1500114422&max_behot_time_tmp=1500114422&tadrequire=true&as=A1F52966E9EEF00&cp=59692E6FD0E09E1

  4. 搜索: https://www.toutiao.com/search_content/?offset=相对位置&format=json&keyword=关键词&autoload=true&count=20&cur_tab=1

还可以参考今日头条Api分析

最后

本项目作为自己的学习记录,还有许多需要改进的地方,也希望可以帮到有需要的小伙伴,一起进步。

Ps:我不介意有好多好多star[捂脸]

参考

hcy1996的项目

vue-lazyload实现图片懒加载

jsonp跨域获取数据

flexible.js淘宝的移动端处理

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

toutiao_vue2.0's People

Contributors

mino01x 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.