分类 uniapp 下的文章

uniapp||vue.js v-html不能解析富文本呢内容


使用v-html只能解析成正确的html代码,不能展示效果
可以先转化为为正确的html再解析

以下代码$符号需改成&符号

function htmlDecode(html) {
 return html.replace(/$lt;|$gt;|$quot;|$amp;/g, match => {
  switch(match) {
  case '$lt;':
   return '<';
  case '$gt;':
   return '>';
  case '$quot;':
   return '"';
  case '$amp;':
   return '&';
 }
 })
}

uniapp QQ小程序添加 加群功能 || uniapp 添加跳转到QQ群


查阅资料发现

<button open-type = "openGroupProfile" group-id="610928288">点我加群</button>
//group-id必须是app.json中有添加的群号  
//及app.json添加groupIdList

"groupIdList":[
   "610928288"
],

uniapp 没有 app.json ,开始猜猜 以为是在 pages.json中添加 groupIdList,但真机运行没有反应

后面想了想,都说在app.json 文件中添加了,应该是uniapp编译的时候没有正确的进行编译,直接打开unpackagedistdevmp-qq项目下的app.json 没有groupIdList,那这个怎么办?

对就是手动添加嘛,添加完就OK,只是要注意,上线记得也在相应的文件中修改一下


uniapp flex 自适应高度 区域里面内容滚动


如下代码,想在页面box中,content固定高度,box-c区域填满其他区域,scroll-view 区域内滚动

<view class="box">
  <view class="content">
   hello
  </view>
  <swiper class="box-c">
   <swiper-item class="child">
    <scroll-view :scroll-y="true">
       足够高的滚动区域
    </scroll-view>
   </swiper-item>
  </swiper>
 </view>

样式如下

 .box{
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  background-color: #ffffff;
  height: 100vh;
 }
 .content{
  height: 70upx;
  background: #CCCCCC;
 }
 .box-c,.child{
  display: flex;
  flex: 1;
 }

总结:swiper 和 swiper-item 都要做填满操作,否则不成功