<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      5.頁面繪制-主題列表頁(使用ColorUI、uni-app官方組件)

      1.主題列表頁

      1.導入ColorUI

      繪制主題列表頁,需要用到ColorUI。

      uni-app插件市場中ColorUI的頁面:

      https://ext.dcloud.net.cn/plugin?id=239

      將ColorUI下載解壓后,將colorui文件夾復制到項目wwab目錄下:

       

       在App.vue中加入代碼:

      @import "colorui/main.css";
      @import "colorui/icon.css";

       

       

       2.新建主題列表頁zhuti_list

      在pages/shequ目錄下新建頁面zhuti_list,然后在pages.json將zhuti_list配置為首頁,方便查看。

       

       zhuti_list.vue中:

      <template>
          <view>
              
              <view v-for="(itme,index) in zhuti_data" :key="index" class="cu-item radius padding-lr-lg shadow-warp bg-white margin-top">
                  <view class="cu-tag bg-red">置頂</view>
                  <view class="cu-tag bg-red">精品</view>
                  <view class="cu-tag bg-red">普通</view>
                  <view class="text-content zhaiyao">
                      青春里,總有些事情要努力去做,總有些夢想要拼命去追,無需計較得失,只要青春無悔。
                  </view>
                  <view class="text-gray text-sm text-right padding">
                      <text class="cuIcon-attentionfill margin-lr-xs"></text> 1分鐘前
                      <text class="cuIcon-attentionfill margin-lr-xs"></text> 1111
                      <text class="cuIcon-messagefill margin-lr-xs"></text> 22222
                  </view>
              </view>
                  
          </view>
      </template>
      
      <script>
          export default {
              data() {
                  return {
                      zhuti_data:['1','2','3','4','5','6','1','2','3','4','5','6']
                  }
              },
              methods: {
                  
              },
              onLoad() {
                  uni.setNavigationBarTitle({
                      title: '暗部智囊'
                  });
              }
          }
      </script>
      
      <style>
      .zhaiyao{
          text-overflow: -o-ellipsis-lastline;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          line-clamp: 2;
          -webkit-box-orient: vertical;
          margin-top: 10upx;
      }
      </style>

      效果圖:

      3.安裝uni-app官方組件

      新建一個項目,選擇Hello uni-app模板

       

       

       將新建的項目目錄下的components目錄復制粘貼到wwab目錄下:

       

       

       4.懸浮按鈕uni-fab

      在zhuti_list.vue中加入uni-fab相關代碼(到阿里圖標網又下載了幾張需要用到的圖標)

      <template>
          <view>
                  
              <uni-fab ref="fab" :pattern="pattern" :content="content" @trigger="trigger"/>    
                  
          </view>
      </template>
      
      <script>
          export default {
              data() {
                  return {    
                      
                      pattern: {
                          color: '#7A7E83',
                          backgroundColor: '#fff',
                          selectedColor: '#007AFF',
                      },
                      content: [{
                              iconPath: '/static/fabu.png',
                              selectedIconPath: '/static/fabu1.png',
                              text: '發主題',
                              active: false
                          },
                          {
                              iconPath: '/static/fanhuidingbu.png',
                              selectedIconPath: '/static/fanhuidingbu.png',
                              text: '返回頂部',
                              active: false
                          }
                      ],
                      
                  }
              },
              onBackPress() {
                  if (this.$refs.fab.isShow) {
                      this.$refs.fab.close()
                      return true
                  }
                  return false
              },
              methods: {
                  trigger(e){
                      // console.log(e)
                      this.content[e.index].active = !e.item.active
                      // uni.showModal({
                      //         title: '提示',
                      //         content: `您${this.content[e.index].active ? '選中了' : '取消了'}${e.item.text}`,
                      //         success: function(res) {
                      //             if (res.confirm) {
                      //                 console.log('用戶點擊確定')
                      //             } else if (res.cancel) {
                      //                 console.log('用戶點擊取消')
                      //             }
                      //         }
                      //     })
                      }
                  
              }
              
          }
      </script>

      效果圖:

      返回頂部功能

      methods: {
                  trigger(e){
                      console.log(e)
                      this.content[e.index].active = !e.item.active
                      if(e.index==1){
                          this.top()
                          }
                      },
                  top() { //回到頂部  
                      uni.pageScrollTo({ 
                        scrollTop: 0, duration: 300 
                      }); 
                    } 
                  
              },

       模態框彈出功能(用的ColorUI的普通模態框)

      在zhuti_list.vue中的相關代碼:

      <template>
          <view>
                      
              <uni-fab ref="fab" :pattern="pattern" :content="content" @trigger="trigger"/>
              
              <view class="cu-modal" :class="modalName=='Modal'?'show':''">
                  <view class="cu-dialog">
                      <view class="cu-bar bg-white justify-end">
                          <view class="content">Modal標題</view>
                          <view class="action" @tap="hideModal">
                              <text class="cuIcon-close text-red"></text>
                          </view>
                      </view>
                      <view class="padding-xl">
                          Modal 內容。
                      </view>
                  </view>
              </view>        
                  
          </view>
      </template>
      
      <script>
          export default {
              data() {
                  return {
                      
                      modalName: null,
                      
                  }
              },
              methods: {
                  trigger(e){
                      console.log(e)
                      this.content[e.index].active = !e.item.active
                      if(e.index==1){
                          this.top()
                      }
                      if(e.index==0){
                          this.showModal()
                      }
                  },
                  
                  
                  showModal(e) {
                      this.modalName = "Modal"
                      console.log(this.modalName)
                  },
                  hideModal(e) {
                      this.modalName = null
                  }
                  
                  
              }
      
              }
          }
      </script>

      效果圖:

       5.模態框中發表主題功能開發

      本來想要用富文本編輯器了,但是對于移動端的各種平臺,很難找到一個都兼容的。

      于是采用類似于微信發朋友圈的方式,發表主題只提供發表長文本+圖片的模式。

      用到ColorUI中的 長文本輸入框組件、圖片上傳組件、按鈕組件。

      注意:

      在模態框中使用圖片上傳組件,會導致圖片顯示不全,是居中導致的。

      解決:在colorui的main.css中找到.cu-modal的樣式,將居中代碼注釋掉。

       

       用ctrl+F直接搜定位。

       

       同樣的方法,在main.css中找到cu-dialog,發現其寬度時680upx,因為上面去掉了居中代碼,所以需要給模態框加一個左邊距,一共寬度是750upx,所以左邊距35upx。

       

       

       

       

      zhuti_list.vue中模態框內相關代碼:

      <view class="cu-modal" :class="modalName=='Modal'?'show':''" >
                  <view class="cu-dialog" style="margin-left: 35upx;">
                      <view class="cu-bar bg-white justify-end">
                          <view class="content">發表主題</view>
                          <view class="action" @click="hideModal">
                              <text class="cuIcon-close text-red"></text>
                          </view>
                      </view>
                      <view class="padding-xl">
                          
                          <view class="cu-bar bg-white margin-top">
                              <view class="action">
                                  圖片上傳
                              </view>
                              <view class="action">
                                  {{imgList.length}}/4
                              </view>
                          </view>
                          <view class="cu-form-group">
                              <view class="grid col-4 grid-square flex-sub">
                                  <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
                                   <image :src="imgList[index]" mode="aspectFill"></image>
                                      <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
                                          <text class='cuIcon-close'></text>
                                      </view>
                                  </view>
                                  <view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
                                      <text class='cuIcon-cameraadd'></text>
                                  </view>
                              </view>
                          </view>
                          
                          <view class="cu-form-group margin-top">
                              <textarea maxlength="-1" spellcheck="false" @input="textareaAInput" placeholder="多行文本輸入框"></textarea>
                          </view>
                          
                          <view class="margin-top" style="display: flex;justify-content: center;">
                              <button class="cu-btn round bg-red shadow lg ">發布</button>
                          </view>
                          
                          
                      </view>
                  </view>
                  

       

      ChooseImage() {
                      uni.chooseImage({
                          count: 4, //默認9
                          sizeType: ['original', 'compressed'], //可以指定是原圖還是壓縮圖,默認二者都有
                          sourceType: ['album'], //從相冊選擇
                          success: (res) => {
                              if (this.imgList.length != 0) {
                                  this.imgList = this.imgList.concat(res.tempFilePaths)
                              } else {
                                  this.imgList = res.tempFilePaths
                              }
                          }
                      });
                  },
                  ViewImage(e) {
                      uni.previewImage({
                          urls: this.imgList,
                          current: e.currentTarget.dataset.url
                      });
                  },
                  DelImg(e) {
                      uni.showModal({
                          title: '提示信息',
                          content: '確定要刪除這張圖片嗎?',
                          cancelText: '取消',
                          confirmText: '刪除',
                          success: res => {
                              if (res.confirm) {
                                  this.imgList.splice(e.currentTarget.dataset.index, 1)
                              }
                          }
                      })
                  },
                  
                  textareaAInput(e) {
                      this.textareaAValue = e.detail.value
                  }

       

      效果圖:

       

       

      zhuti_list.vue完整代碼:

      <template>
          <view>
              <view v-for="(itme,index) in zhuti_data" :key="index" class="cu-item radius padding-lr-lg shadow-warp bg-white margin-top">
                  <view class="cu-tag bg-red">置頂</view>
                  <view class="cu-tag bg-red">精品</view>
                  <view class="cu-tag bg-red">普通</view>
                  <view class="text-content zhaiyao">
                      青春里,lllbyvu總有些事情要努力去做,總有些夢想要拼命去追,無需計較得失,只要青春無悔。
                  </view>
                  <view class="text-gray text-sm text-right padding">
                      <text class="cuIcon-attentionfill margin-lr-xs"></text> 1分鐘前
                      <text class="cuIcon-attentionfill margin-lr-xs"></text> 1111
                      <text class="cuIcon-messagefill margin-lr-xs"></text> 22222
                  </view>
              </view>
              <u-gap height="80" bg-color="#fff"></u-gap>
              <u-divider color="#6d6d6d" half-width="80" border-color="#6d6d6d">?玩蛇的胖紙為網絡文學而開發</u-divider>
              <u-gap height="80" bg-color="#fff"></u-gap>
              <uni-fab ref="fab" :pattern="pattern" :content="content" @trigger="trigger"/>
              <view class="cu-modal" :class="modalName=='Modal'?'show':''" >
                  <view class="cu-dialog" style="margin-left: 35upx;">
                      <view class="cu-bar bg-white justify-end">
                          <view class="content">發表主題</view>
                          <view class="action" @click="hideModal">
                              <text class="cuIcon-close text-red"></text>
                          </view>
                      </view>
                      <view class="padding-xl">
                          
                          <view class="cu-bar bg-white margin-top">
                              <view class="action">
                                  圖片上傳
                              </view>
                              <view class="action">
                                  {{imgList.length}}/4
                              </view>
                          </view>
                          <view class="cu-form-group">
                              <view class="grid col-4 grid-square flex-sub">
                                  <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
                                   <image :src="imgList[index]" mode="aspectFill"></image>
                                      <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
                                          <text class='cuIcon-close'></text>
                                      </view>
                                  </view>
                                  <view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
                                      <text class='cuIcon-cameraadd'></text>
                                  </view>
                              </view>
                          </view>
                          
                          <view class="cu-form-group margin-top">
                              <textarea maxlength="-1" spellcheck="false" @input="textareaAInput" placeholder="多行文本輸入框"></textarea>
                          </view>
                          
                          <view class="margin-top" style="display: flex;justify-content: center;">
                              <button class="cu-btn round bg-red shadow lg ">發布</button>
                          </view>
                      </view>
                  </view>        
              </view>
              <u-gap height="80" bg-color="#fff"></u-gap>        
                  
          </view>
      </template>
      
      <script>
          export default {
              data() {
                  return {
                      zhuti_data:['1','2','3','4','5','6','1','2','3','4','5','4','5','6','1','2','3','4','5','6'],
                      pattern: {
                          color: '#7A7E83',
                          backgroundColor: '#fff',
                          selectedColor: '#007AFF',
                      },
                      content: [{
                              iconPath: '/static/fabu.png',
                              selectedIconPath: '/static/fabu1.png',
                              text: '發主題',
                              active: false
                          },
                          {
                              iconPath: '/static/fanhuidingbu.png',
                              selectedIconPath: '/static/fanhuidingbu.png',
                              text: '返回頂部',
                              active: false
                          }
                      ],
                      modalName: null,
                      imgList: [],
                      textareaAValue: ''
                  }
              },
              onBackPress() {
                  if (this.$refs.fab.isShow) {
                      this.$refs.fab.close()
                      return true
                  }
                  return false
              },
              methods: {
                  trigger(e){
                      console.log(e)
                      this.content[e.index].active = !e.item.active
                      if(e.index==1){
                          this.top()
                      }
                      if(e.index==0){
                          this.showModal()
                      }
                  },
                  //回到頂部
                  top(){uni.pageScrollTo({ scrollTop: 0, duration: 300 });},
                  showModal(e) {
                      this.modalName = "Modal"
                      console.log(this.modalName)
                  },
                  hideModal(e) {
                      this.modalName = null
                  },
                  
                  ChooseImage() {
                      uni.chooseImage({
                          count: 4, //默認9
                          sizeType: ['original', 'compressed'], //可以指定是原圖還是壓縮圖,默認二者都有
                          sourceType: ['album'], //從相冊選擇
                          success: (res) => {
                              if (this.imgList.length != 0) {
                                  this.imgList = this.imgList.concat(res.tempFilePaths)
                              } else {
                                  this.imgList = res.tempFilePaths
                              }
                          }
                      });
                  },
                  ViewImage(e) {
                      uni.previewImage({
                          urls: this.imgList,
                          current: e.currentTarget.dataset.url
                      });
                  },
                  DelImg(e) {
                      uni.showModal({
                          title: '提示信息',
                          content: '確定要刪除這張圖片嗎?',
                          cancelText: '取消',
                          confirmText: '刪除',
                          success: res => {
                              if (res.confirm) {
                                  this.imgList.splice(e.currentTarget.dataset.index, 1)
                              }
                          }
                      })
                  },
                  
                  textareaAInput(e) {
                      this.textareaAValue = e.detail.value
                  }        
              },
              onLoad() {
                  uni.setNavigationBarTitle({
                      title: '暗部智囊'
                  });
              }
          }
      </script>
      <style>
      .zhaiyao{
          text-overflow: -o-ellipsis-lastline;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          line-clamp: 2;
          -webkit-box-orient: vertical;
          margin-top: 10upx;
      }
      </style>

       注意:

      根據一個產品經理課程中所說的,所有不可撤銷返回的操作,都應該有一個確認的彈窗提示用戶。

      所以在發新主題功能中的插入圖片功能 ,在刪除圖片的時候 ,也應該有一個彈窗來問用戶是否確認刪除。

      但是這個時候,彈窗被模態框擋住。

      解決方式:

      在App.vue中加入:

              uni-modal{
                      z-index: 19999 !important;
                  }

       

       

       

      posted @ 2021-07-01 18:41  雪落憶海  閱讀(1133)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 一女被多男玩喷潮视频| av午夜福利一片看久久| 精品国产污污免费网站入口| 人妻少妇偷人精品免费看| 亚洲欧美人成电影在线观看| 色偷偷亚洲男人的天堂| 日韩熟妇中文色在线视频 | 德庆县| 日韩亚洲国产中文永久| 制服 丝袜 亚洲 中文 综合| 女高中生自慰污污网站| 亚洲熟女乱综合一区二区| 日本高清中文字幕免费一区二区| 盐津县| 欧美精品一区二区三区中文字幕 | 高清美女视频一区二区三区| 国产福利深夜在线观看| 亚洲国产日韩一区三区| 成人免费无遮挡在线播放| 亚洲香蕉免费有线视频| 啦啦啦视频在线日韩精品| 国产睡熟迷奷系列网站| 国产综合色在线精品| 色噜噜狠狠成人综合| 四虎影视库国产精品一区| а天堂中文最新一区二区三区| 欧美成人精品手机在线| 亚洲日本乱码熟妇色精品| 久久精品国产亚洲不av麻豆| аⅴ天堂中文在线网| 男女性杂交内射女bbwxz| 国内精品大秀视频日韩精品| 色偷偷女人的天堂亚洲网| 欧美乱妇高清无乱码免费| 馆陶县| 国产仑乱无码内谢| 久久久亚洲欧洲日产国码αv | 撕开奶罩揉吮奶头高潮AV| 最新的国产成人精品2020| 亚洲免费的福利片| 亚洲婷婷综合色高清在线|