使用Vue前端框架实现知乎日报app

这是:主页代码

<template><view class="content"><view class="uni-list"><!--这是图片轮播的--><swiper :indicator-dots="true"  :autoplay="true" :interval="3000" :duration="500"><swiper-item v-for="item in top_stories " :key="item" @tap="openinfo" :data-newsid="item.id"><image :src="item.images" style="width: 100%;"></image></swiper-item></swiper><text>今日热闻</text><!--这是列表信息--><view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(item,index) in list" :key="index" @tap="openinfo":data-newsid="item.id"><view class="uni-media-list"><image class="uni-media-list-logo" :src="item.images"></image><view class="uni-media-list-body"><view class="uni-media-list-text-top">{{item.title}}</view></view></view></view></view></view>
</template><script>export default {data() {return {list: [],top_stories: []};},onLoad: function() {uni.request({url: 'https://news-at.zhihu.com/api/4/news/latest',method: 'GET',success: res => {this.list = res.data.stories;this.top_stories = res.data.stories;},fail: () => {},complete: () => {}});},methods: {openinfo(e) {var newsid = e.currentTarget.dataset.newsid;uni.navigateTo({url: '../info/info?newsid=' + newsid,});},}}
</script><style>.uni-media-list-body {height: auto;}.uni-media-list-text-top {line-height: 1.6em;}
</style>

这是:跳转后页面主题的信息

<template><view class="content"><view><image class="uni-media-list-logo" :src="imgage" style="width: 400px;height: 400px;"></image></view><view class="title">{{title}}</view><view class="art-content"><rich-text class="richText"  :nodes="strings"></rich-text></view></view>
</template><script>export default {data(){return{title:'',strings:'',imgage:''}    },onLoad:function(e){uni.request({url: 'http://news-at.zhihu.com/api/2/news/'+e.newsid,method: 'GET',data: {},success: res => {this.title=res.data.title;// 替换中文双引号this.strings=res.data.body.replace("type=“text/javascript”",'type="text/javascript"');this.imgage=res.data.image;},fail: () => {},complete: () => {}});}}</script><style>
.content{padding: 10upx 2%; width: 96;flex-wrap: wrap;}
.title{line-height: 2em;font-weight: 700;font-size: 38upx;}
.art-content{line-height: 2e}
.uni-media-list-logo{width: 400px;height: 400px;}
</style>

图片演示:

转存失败重新上传取消

资源地址:https://github.com/nongzihong/uni_app_zhihuribao

posted @ 2018-11-26 16:02 梓鸿 阅读(...) 评论(...) 编辑 收藏

使用Vue前端框架实现知乎日报app相关推荐

  1. 使用vue.js构建一个知乎日报

    Vue.js是我所喜爱的,知乎也是我喜爱的,突发奇想使用vue做了一个知乎日报 项目地址: Github地址 在线预览demo 设计: 1.设计上没有按照知乎日报客户端的交互及UI设计来做,本渣亲自捏 ...

  2. 2021 年 Angular vs. React vs. Vue 前端框架对比

    2021 年 Angular vs. React vs. Vue 前端框架对比 一个是 UI 库(React),另一个是成熟的前端框架(Angular),而其中最年轻的(Vue)则可以称之为渐进式框架 ...

  3. vue前端框架有哪些

    vue前端框架有哪些 2022-02-23 · Worktile 项目协作工具 vue前端UI框架有:1.Element 2.iview 3.vuetify 4.vue-strap 5.cube-ui ...

  4. 分布式电商项目十四:Vue前端框架简介及使用

    Vue前端框架简介及使用 就像是后端我们使用springboot来进行开发一样,前端需要使用Vue框架进行开发.由于前端不是我们的主要内容,所以只介绍简单的使用内容.具体更深的内容请参考Vue的官方网 ...

  5. Element ui+vue前端框架组件主题美化后台管理系统模板html

    最新设计了一套Element ui主题模板 演示地址:Element ui+vue前端框架组件主题美化后台管理系统模板 Element ui版本号:2.15.12        vue版本号:2.7. ...

  6. Vue前端框架选型论述

    Vue前端框架选型论述 1. 前端3大巨头框架综述 React 起源于 Facebook 的内部项目,社区非常活跃,下载使用当前排行第一名,但是 React 的只能是半开源,在不涉及到 Faceboo ...

  7. 搭建vue前端框架或微信小程序vue框架步骤

    搭建vue前端框架或微信小程序vue框架步骤 1.下载node.js 下载地址:https://nodejs.org/en/download/ 查看node.npm版本,确保环境正确 node --v ...

  8. 基于vue前端框架_基于前端访问控制框架的Vue

    基于vue前端框架 权限访问控制 (vue-access-control) Vue-Access-Control is a solution of front-end user rights cont ...

  9. html接入qq客服,Vue 前端框架接入QQ在线客服

    Vue 前端框架接入QQ在线客服,效果如下图: 后面就根据自己的需要选择不同的方式,下面是使用教程: ------------------------------------------------- ...

最新文章

  1. python的jupyter的使用教程-Python·Jupyter Notebook各种使用方法
  2. python打出由边框包围的_python – 提取边框并将其保存为图像
  3. 【数据结构与算法】中缀表达式 - 后缀表达式 - 求值
  4. RabbitMQ 从入门到精通 (一)
  5. java newfile() bug_java-运行类时,它将生成一个0kb的空白文件.有人可以指出我的错误之处吗?...
  6. android控制灯编程,远程控制智能灯(android)
  7. 如何查看当前所用浏览器版本是否支持Vue3+ElementUIPlus
  8. Delphi中VCL库的原架构师Chuck Jazdzewski回忆Delphi 1的开发原则
  9. graphpad两组t检验_Graphpad Prism如何科学地选择统计学方法
  10. MacBook M1芯片 安装Centos8 教程(无界面安装)
  11. 【QCM2150】WFA 11ac 4.2.43测试失败及解决方案
  12. 根据工作日/节假日收货要求计算预计发货时间
  13. 给自己的网站添加在线客服代码
  14. oracle比较两个时间
  15. 微信小程序实现文字识别-ocr插件
  16. html下拉控件 拼音检索和中文检索,Combobox控件实现汉字按拼音首字母检索
  17. 【预测】中国2015年将陷入20年来最严重的失业潮和减薪潮!
  18. WF2011 Chips Challenge
  19. HTTPS代理的工作原理
  20. 树莓派魔镜总结(包括语音和图像识别)

热门文章

  1. 菜谱分享网站微信小程序开发说明(2)-数据库
  2. 2021年第十二届蓝桥杯大赛软件赛决赛C/C++大学A组 个人部分题解
  3. 大彩串口屏之LUA使用1
  4. 中国货币政策的动态有效性研究--基于 TVP-SV-FAVAR 模型的实证分析
  5. GitHub两天标星2.1K+!自动刷喵币靠这一个脚本就够了.....
  6. ipsec-***过程
  7. OS学习笔记-20(清华大学慕课)死锁和进程通信
  8. 工程伦理 清华慕课网答案
  9. Android Minui 相关API说明
  10. 思维导图怎么画?原来思维导图还可以这样绘制