|
本帖最后由 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.安装好以后,打开,新建项目
建好以后是这样子滴,不得不说华为还是很贴心的,好多提示都是新手不容易注意到的,而且所有的命令行都不需要啦~~~例如包名不能与原生app重复
如果你的手机连接电脑,并且打开了usb调试,会自动连接手机。并且点击的话会提示安装一个引擎,叫快应用加载器,安装就行了。然后要提示一下,之前用命令行创建的项目不可以用这个调试~
3.点击文件-> 新建页面
建好以后,会自动添加manifest.json 配置好,很舒服,好贴心啊~~~么么哒~再也不用打该死的命令行了~~~
4. 安装less依赖 这个是需要打命令行的
首先,ctrl + ~ 打开终端 命令行:npm install less --save-dev
npm install less-loader --save-dev
(上面是两条命令,能明白吧!)
5.翠花,上代码!!!!!!(哈哈)
- <template>
- <div class="tutorial-page">
- <tabs onchange="onChangeTabIndex">
- <tab-bar class="tab-bar" mode="scrollable">
- <text for="{{tabHeadList}}" class="{{currentIndex === $idx ? 'active' : ''}}">{{$item.title}}</text>
- </tab-bar>
- <tab-content class="tab-content">
- <div class="tab-content-section" for="{{tabHeadList}}">
- <refresh class="demo-page" refreshing="{{isrefresh}}" @refresh="pageRefresh">
- <list style="flex-direction:column;columns: 1" @scrollbottom="listScrollBottom">
- <block for="(index,item) in list">
- <list-item class="content-item" type="productArt">
- <div style="width:100%;height:100px;">
- <text>
- {{item.content}}:{{index}}
- </text>
- </div>
- </list-item>
- <list-item type="loadMore" style="justify-content: center;margin-bottom: 20px" if="{{index == (list.length-1)}}">
- <progress type="circular"></progress>
- <text style="margin-left: 20px">加载更多</text>
- </list-item>
- </block>
- </list>
- </refresh>
- </div>
- </tab-content>
- </tabs>
- </div>
- </template>
-
- <style lang="less">
- .tutorial-page {
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .tab-bar text {
- padding: 0 25px;
- text-align: center;
- font-size: 34px;
- }
- .tab-bar .active {
- color: #FF0000;
- }
- .tab-content {
- flex: 1;
- background-color: #eeeeee;
- .tab-content-section {
- flex: 1;
- margin: 10px;
- background-color: #ffffff;
- justify-content: center;
- text {
- text-align: center;
- color: #FF0000;
- }
- }
- }
- }
-
- .content-item {
- align-items: center;
- justify-content: space-between;
- border-bottom-color: #eeeeee;
- border-bottom-width: 1px;
- background-color: #ffffff;
-
- }
- </style>
-
- <script>
- import prompt from '@system.prompt'
- export default {
- private: {
- tabHeadList: [
- { title: '推荐' },
- { title: '热门' },
- { title: '视频' },
- { title: '段子' },
- { title: '汽车' },
- { title: '社会' },
- { title: '娱乐' },
- { title: '军事' },
- { title: '体育' },
- { title: 'NBA' },
- { title: '财经' }
- ],
- list: [
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
- { content: "推荐推荐推荐推荐" },
-
- ],
- jzlist: [
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- { content: "系内容系内容系内容" },
- ],
- isrefresh: false,
- currentIndex: 0
- },
- onInit() {
- // 加载第一个页签内容
- this.changeTabIndex(0)
- },
- changeTabIndex(index) {
- const item = Object.assign({}, this.tabHeadList[index])
- this.tabHeadList.splice(index, 1, item)
- },
- onChangeTabIndex(evt) { //切换页面重新加载数据
- this.currentIndex = evt.index
- this.changeTabIndex(evt.index)
- prompt.showToast({
- message: '加载完成'
- })
- },
- listScrollBottom() { //下拉刷新 继续加载 分页内容
- var _this = this
- var list = this.jzlist;
- list.forEach((item, index) => {
- _this.list.push(item);
- })
- prompt.showToast({
- message: '加载完成'
- })
- },
- pageRefresh: function (e) { //上拉加载 刷新重新获取
- this.isrefresh = e.refreshing;
- setTimeout(() => {
- this.isrefresh = false;
- console.log(this.isrefresh)
- this.list = [];
- var list = this.jzlist;
- var _this = this
- list.forEach((item, index) => {
- _this.list.push(item);
- })
- prompt.showToast({
- message: '刷新完成'
- })
- }, 1000);
- },
- }
- </script>
复制代码
6.上面这段是可以滑动刷新的效果,样子不是特别好看,临时搞得,是我们开发页面很常用的,上拉刷新,下拉加载,左右滑动替换列表~
可以复制直接用哦~
com.index.wzs.quickapp.zip
(68.51 KB, 下载次数: 0)
|
|