找回密码
 立即注册
搜索

技术分享 #快应用代码征集令#华为IDE教程,信息流瀑布页面所有功能...

1
回复
2492
查看
[复制链接]

5

主题

25

帖子

150

积分

 楼主| 2018-7-27 17:21:42 显示全部楼层 |阅读模式
本帖最后由 935485428 于 2018-7-27 18:12 编辑 1.首先安装一个华为的IDE,下载链接 https://omp.hicloud.com/dsm/hms/cn/catalog/fastapp.html?page=fastapp_fastapp_devprepare_install_tool 2.安装好以后,打开,新建项目 新建项目.jpg 建好以后是这样子滴,不得不说华为还是很贴心的,好多提示都是新手不容易注意到的,而且所有的命令行都不需要啦~~~例如包名不能与原生app重复 建好以后.jpg 调试模式.jpg 如果你的手机连接电脑,并且打开了usb调试,会自动连接手机。并且点击的话会提示安装一个引擎,叫快应用加载器,安装就行了。然后要提示一下,之前用命令行创建的项目不可以用这个调试~ 3.点击文件-> 新建页面 建好以后,会自动添加manifest.json 配置好,很舒服,好贴心啊~~~么么哒~再也不用打该死的命令行了~~~ 新建页面.jpg 4. 安装less依赖 这个是需要打命令行的 首先,ctrl + ~ 打开终端 命令行:npm install less --save-dev npm install less-loader --save-dev (上面是两条命令,能明白吧!) 5.翠花,上代码!!!!!!(哈哈)
  1. <template>
  2. <div class="tutorial-page">
  3. <tabs onchange="onChangeTabIndex">
  4. <tab-bar class="tab-bar" mode="scrollable">
  5. <text for="{{tabHeadList}}" class="{{currentIndex === $idx ? 'active' : ''}}">{{$item.title}}</text>
  6. </tab-bar>
  7. <tab-content class="tab-content">
  8. <div class="tab-content-section" for="{{tabHeadList}}">
  9. <refresh class="demo-page" refreshing="{{isrefresh}}" @refresh="pageRefresh">
  10. <list style="flex-direction:column;columns: 1" @scrollbottom="listScrollBottom">
  11. <block for="(index,item) in list">
  12. <list-item class="content-item" type="productArt">
  13. <div style="width:100%;height:100px;">
  14. <text>
  15. {{item.content}}:{{index}}
  16. </text>
  17. </div>
  18. </list-item>
  19. <list-item type="loadMore" style="justify-content: center;margin-bottom: 20px" if="{{index == (list.length-1)}}">
  20. <progress type="circular"></progress>
  21. <text style="margin-left: 20px">加载更多</text>
  22. </list-item>
  23. </block>
  24. </list>
  25. </refresh>
  26. </div>
  27. </tab-content>
  28. </tabs>
  29. </div>
  30. </template>
  31. <style lang="less">
  32. .tutorial-page {
  33. flex-direction: column;
  34. justify-content: center;
  35. align-items: center;
  36. .tab-bar text {
  37. padding: 0 25px;
  38. text-align: center;
  39. font-size: 34px;
  40. }
  41. .tab-bar .active {
  42. color: #FF0000;
  43. }
  44. .tab-content {
  45. flex: 1;
  46. background-color: #eeeeee;
  47. .tab-content-section {
  48. flex: 1;
  49. margin: 10px;
  50. background-color: #ffffff;
  51. justify-content: center;
  52. text {
  53. text-align: center;
  54. color: #FF0000;
  55. }
  56. }
  57. }
  58. }
  59. .content-item {
  60. align-items: center;
  61. justify-content: space-between;
  62. border-bottom-color: #eeeeee;
  63. border-bottom-width: 1px;
  64. background-color: #ffffff;
  65. }
  66. </style>
  67. <script>
  68. import prompt from '@system.prompt'
  69. export default {
  70. private: {
  71. tabHeadList: [
  72. { title: '推荐' },
  73. { title: '热门' },
  74. { title: '视频' },
  75. { title: '段子' },
  76. { title: '汽车' },
  77. { title: '社会' },
  78. { title: '娱乐' },
  79. { title: '军事' },
  80. { title: '体育' },
  81. { title: 'NBA' },
  82. { title: '财经' }
  83. ],
  84. list: [
  85. { content: "推荐推荐推荐推荐" },
  86. { content: "推荐推荐推荐推荐" },
  87. { content: "推荐推荐推荐推荐" },
  88. { content: "推荐推荐推荐推荐" },
  89. { content: "推荐推荐推荐推荐" },
  90. { content: "推荐推荐推荐推荐" },
  91. { content: "推荐推荐推荐推荐" },
  92. { content: "推荐推荐推荐推荐" },
  93. { content: "推荐推荐推荐推荐" },
  94. { content: "推荐推荐推荐推荐" },
  95. { content: "推荐推荐推荐推荐" },
  96. { content: "推荐推荐推荐推荐" },
  97. { content: "推荐推荐推荐推荐" },
  98. { content: "推荐推荐推荐推荐" },
  99. { content: "推荐推荐推荐推荐" },
  100. { content: "推荐推荐推荐推荐" },
  101. ],
  102. jzlist: [
  103. { content: "系内容系内容系内容" },
  104. { content: "系内容系内容系内容" },
  105. { content: "系内容系内容系内容" },
  106. { content: "系内容系内容系内容" },
  107. { content: "系内容系内容系内容" },
  108. { content: "系内容系内容系内容" },
  109. { content: "系内容系内容系内容" },
  110. { content: "系内容系内容系内容" },
  111. { content: "系内容系内容系内容" },
  112. { content: "系内容系内容系内容" },
  113. { content: "系内容系内容系内容" },
  114. { content: "系内容系内容系内容" },
  115. { content: "系内容系内容系内容" },
  116. { content: "系内容系内容系内容" },
  117. { content: "系内容系内容系内容" },
  118. { content: "系内容系内容系内容" },
  119. { content: "系内容系内容系内容" },
  120. { content: "系内容系内容系内容" },
  121. ],
  122. isrefresh: false,
  123. currentIndex: 0
  124. },
  125. onInit() {
  126. // 加载第一个页签内容
  127. this.changeTabIndex(0)
  128. },
  129. changeTabIndex(index) {
  130. const item = Object.assign({}, this.tabHeadList[index])
  131. this.tabHeadList.splice(index, 1, item)
  132. },
  133. onChangeTabIndex(evt) { //切换页面重新加载数据
  134. this.currentIndex = evt.index
  135. this.changeTabIndex(evt.index)
  136. prompt.showToast({
  137. message: '加载完成'
  138. })
  139. },
  140. listScrollBottom() { //下拉刷新 继续加载 分页内容
  141. var _this = this
  142. var list = this.jzlist;
  143. list.forEach((item, index) => {
  144. _this.list.push(item);
  145. })
  146. prompt.showToast({
  147. message: '加载完成'
  148. })
  149. },
  150. pageRefresh: function (e) { //上拉加载 刷新重新获取
  151. this.isrefresh = e.refreshing;
  152. setTimeout(() => {
  153. this.isrefresh = false;
  154. console.log(this.isrefresh)
  155. this.list = [];
  156. var list = this.jzlist;
  157. var _this = this
  158. list.forEach((item, index) => {
  159. _this.list.push(item);
  160. })
  161. prompt.showToast({
  162. message: '刷新完成'
  163. })
  164. }, 1000);
  165. },
  166. }
  167. </script>
复制代码
6.上面这段是可以滑动刷新的效果,样子不是特别好看,临时搞得,是我们开发页面很常用的,上拉刷新,下拉加载,左右滑动替换列表~ 可以复制直接用哦~ com.index.wzs.quickapp.zip (68.51 KB, 下载次数: 0)
回复

使用道具 举报

5

主题

25

帖子

150

积分

 楼主| 2018-7-27 17:24:46 显示全部楼层
#快应用代码征集令#华为IDE教程,信息流瀑布页面所有功能... https://bbs.quickapp.cn/forum.ph ... id=851&fromuid=6814
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册