小程序开发:flex--swiper--movable area--icon

flex

.container{
  display: flex;
  /* flex-direction: row; */
  /* sort on left; */
  /* flex-direction: row-reverse; */
  /* sort on right */
  /* flex-direction: column; */
  /* top to down */
  /* flex-direction: column-reverse; */
  /* down to top*/
  
  /* defult no wrap */
  /* flex-wrap: nowrap; */
  /* flex-wrap: wrap; */
  /* flex-wrap: wrap-reverse */
  /* reverse-wrap */

  /* 左对齐 */
  /* justify-content: flex-start */
  /* 右对齐 */
  /* justify-content: flex-end; */
  /* 居中对齐 */
  /* justify-content:center; */
  justify-content:center;
  /* 成员周围包裹空白 */
  /* justify-content:space-around; */
  /* 成员之间留空白 */
  /* justify-content:space-between; */
} 
<view class="container">
    <!-- hover-class触摸时改变渲染的类 -->
    <!-- hover-start-time 触摸时改变的时间 -->
    <view class="a size" hover-class="d" hover-start-time="3000">a</view>
</view>

swiper图标滚动播放

<!-- indicator-dots是否显示面板指示点 -->
<!-- autoplay自动播放 -->
<!-- interval自动播放时间间隔 -->
<!-- duration过度动画时长 -->
<!-- swiper-item为滚动组件的元素 -->
<swiper indicator-dots="{{indicatorDots}}"
  autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
  <block wx:for="{{imgUrls}}">
    <swiper-item>
      <image src="{{item}}" class="slide-image" width="355" height="150"/>
    </swiper-item>
  </block>
</swiper>

<!-- slider滑动条 -->
<!-- show-value min max设置数值 -->
<!-- bindchange绑定滑动事件 -->
<button bindtap="changeIndicatorDots"> indicator-dots </button>
<button bindtap="changeAutoplay"> autoplay </button>
<slider bindchange="intervalChange" show-value min="500" max="2000"/>
<slider bindchange="durationChange" show-value min="1000" max="10000"/>

js

Page({
  data: {
    imgUrls: [
      'https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640',
      'https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640',
      'https://images.unsplash.com/photo-1551446591-142875a901a1?w=640'
    ],
    indicatorDots: false,
    autoplay: false,
    interval: 5000,
    duration: 1000
  },
  changeIndicatorDots: function (e) {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },
  changeAutoplay: function (e) {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },
  intervalChange: function (e) {
    this.setData({
      interval: e.detail.value
    })
  },
  durationChange: function (e) {
    this.setData({
      duration: e.detail.value
    })
  }
})

scroll

<!--index.wxml-->
<!-- bindscrolltoupper当滚动到顶部时绑定一个事件 -->
<!-- bindscroll绑定滚动时的事件 -->
<!-- upper-threshold触发事件的阈值 -->
<!-- scroll-into-view滚动到指定id的view组件 -->
<!-- scroll-top设置竖直滚动条距顶部的位置 -->
<!-- scroll-left设置横向滚动条距左边的位置 -->
<!-- enable-back-to-top点击状态栏回到顶部 -->
<!-- scroll-with-animation过渡动画 -->
<scroll-view scroll-y="true" style="height:300rpx;" bindscrolltoupper="toupper" bindscrolltolower="tolower" upper-threshold ="0" lower-threshold="0" enable-back-to-top="true" scroll-with-animation="true" scroll-into-view ="c">
    <view id ="a" class="a size">a</view>
    <view id ="b" class="b size">b</view>
    <view id ="c" class="c size">c</view>
    <view id ="d" class="d size">d</view>
    <view id ="e" class="e size">e</view>
</scroll-view>

<!-- 横向滚动 -->
<scroll-view class= "container" scroll-x="true" style="height:300rpx;" scroll-into-view="c">
    <view id ="a" class="a size">a</view>
    <view id ="b" class="b size">b</view>
    <view id ="c" class="c size">c</view>
    <view id ="d" class="d size">d</view>
    <view id ="e" class="e size">e</view>
</scroll-view>

js


Page({
  data:{

  },
  toupper: function(){
    console.log("scroll to top");
  },
  tolower: function () {
    console.log("scroll to fooder");
  }
  
})

movable area

<movable-area class="father-size">
    <!-- direction移动的方向 -->
    <!-- out-of-bounds当滑块超出范围后是否还能移动 -->
    <!-- damping移动阻尼 -->
    <!-- scale双指缩放 -->
    <!-- scale-min scale-max缩放的最大最小倍数 -->
    <!-- disable禁用拖动 -->
    <!-- bindchange绑定拖动事件 -->
    <!-- bindscale绑定缩放事件 -->
    <movable-view class="size" direction = "all" out-of-bounds="true" x="50" y="100" bindchange = "dochange" >
    </movable-view>
</movable-area>

js


Page({
  data: {
  },
  dochange: function(){
    console.log("be moved")
  }
})

icon

<icon type = "success" size="66" color="red"></icon>
<icon type = "success_no_circle" size="66"></icon>
<icon type = "info" size="66"></icon>
<icon type = "warn" size="66" ></icon>
<icon type = "waiting" size="66" ></icon>
<icon type = "cancle" size="66" ></icon>
<icon type = "download" size="66" ></icon>
<icon type = "search" size="66" ></icon>
<icon type = "clear" size="66" ></icon>


<!-- selectable文本是否可选 -->
<!-- \n \t转义 -->
<view>
    <text selectable="true">this is a text \n nextline</text>
</view>


<!-- decode解码 -->
<view>
    <text selectable="true" decode="true">&nbsp; &lt; &gt; &amp; &apos; &ensp; &emsp;</text>
</view>


<!-- <富文本> -->
<view>
    <rich-text nodes ="{{mycontent}}"></rich-text>
</view>
<!-- percent 百分比 -->
<!-- show-info 显示百分比 -->
<!-- stroke-width显示进度条的宽度 -->
<!-- activeColor前景色 -->
<!-- backgroundColor背景色 -->
<!-- active填充动画 -->
<!-- active-mode动画模式, backwards从头开始 forwards从上次结束开始 -->
<progress percent="30" show-info="true" stroke-width="10" activeColor="green" backgroundColor="grey" active="true"></progress>
<progress percent="{{mypercent}}" show-info="true" stroke-width="10"      active-mode="forwards" active="true"></progress>
<button bindtap = "addpercent">tap to add</button>

js


Page({
  data: {
    // 富文本参数数组
    mycontent:[
      {
        name: "img",
        attrs:{
          class:"u-courseCardWithTime-img_img161",
          src: "http://edu-image.nosdn.127.net/c3046f2a240f4d7fbc0c2582f4daa904.jpg?                        imageView&amp;quality=100",

        }
      }
    ],
    mypercent: 15
  },
  dochange: function(){
    console.log("be moved")
  },

  addpercent: function(){
    var newpercent = this.data.mypercent + 15;
    this.setData({
      mypercent: newpercent
    })
  }
})

原文地址:https://blog.csdn.net/weixin_44130043/article/details/98373561

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


一:display:flex布局display:flex是一种布局方式。它即可以应用于容器中,也可以应用于行内元素。是W3C提出的一种新的方案,可以简便、完整、响应式地实现各种页面布局。目前,它已经得到了所有浏览器的支持。Flex是FlexibleBox的缩写,意为"弹性布局",用来为盒状模型提供最大的灵
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何垂直居中对齐,方法有很多,但是在学习了flex布局之后,垂直居中更加容易实现HTML代码:1<divclass="demo">2<divclass="inner">3<p>这是一个测试这是一个测试这是一个测试这是一个测试这是一个测试</p>4</div
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些应用。常见的例子,比如360杀毒,photoShop,VisualStudioCode等等移动端app是什么,有哪些应用。常见的例子,比如手机微信,手机qq,手机浏览器,美颜相机等等PC端与移动端的区别第一:PC考虑的是浏览器的兼容性,移动端考
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周末了,难得学点东西,grid是之前看到的,很好奇,讲的二维的布局,看起来很方便,应该很适合移动端布局,所以今天抽时间学一学,这个当是笔记了。参考的是阮老师的博客。阮一峰:CSSGrid网格布局教程http://www.ruanyifeng.com/blog/2019/03/g
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后,浮动,定位将不会有效果)给父元素设置的属性:(1)display:flex---把容器设置为弹性盒模型。(2)flex-direction---设置弹性盒模型主轴方向默认情况下主
我在网页上运行了一个Flex应用程序,我想使用Command←组合键在应用程序中触发某些操作.这在大多数浏览器上都很好,但在Safari上,浏览器拦截此键盘事件并导致浏览器“返回”事件.有没有办法,通过Flex或通过页面上的其他地方的JavaScript,我可以告诉Safari不要这样做?解决方法:简短的
flex布局,flex-item1<template>2<viewclass="container">3<viewclass="greentxt">4A5</view>6<viewclass="redtxt">7B8<
我应该设计一个大型多点触控屏幕的应用程序.从大到大,我的意思是新闻广播员(大约55英寸及以上).该应用程序是一个交互式地图.我的问题是:开发应用程序的技术.我的第一个想法是在AdobeFlex中制作,但是HTML5也是如此……必须有一些非常棒的Java库用于触摸交互,但是在Windows平台上
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><metahttp-equiv="X-UA-Compatible&quo
【1】需求:  【2】解决方案:最近遇到布局上要求item两端对齐,且最后一行在列不满的情况下要求左对齐,使用flex的justify-content:space-between;实现时发现最后一行不能左对齐,而是两端对齐方式。 不是项目上想要的效果#网上查了一些资料,有两种方法可以实现效果:**1.
我有一个java套接字服务器,它在连接时将Animal对象发送到Flash客户端.对象发送方式如下:Amf3Outputamf3Output=newAmf3Output(SerializationContext.getSerializationContext());amf3Output.setOutputStream(userSocket.getOutputStream());amf3Output.writeObject(animal)
我正在开发一个Flex3.4应用程序,它通过最新版本的BlazeDS与JBoss-4.2.2服务器上运行的JavaEE后端进行交互.当我在Tomcat上从FlashBuilder4beta2运行Flex应用程序时,一切都很好,Flex应用程序能够进行所需的远程调用.但我的生产环境是在JBoss上,当我将应用程序移动到JBoss时(更
我有一个非常大的问题.我使用Flex3/Tomcat/BlazeDS/Spring编写了一个大型应用程序,在本地开发时运行良好,当我部署到公共开发环境时很好,但是当部署到我们的测试环境时经常失败.当远程处理请求花费大量时间(超过20秒)时,故障似乎最常发生.在我的开发服务器上,错误发生,但仅
弹性和布局display:flex在ie6,ie7不兼容状态,一般在pc用的比较少,在手机端所有的浏览器都是支持的控制子元素在父元素里面的位置关系display:flex是给父元素加的文档流是按照主轴排列,只要父元素加了flex,那么里面的子元素全部可以直接添加宽高主轴的方向
FLEX2.0源码分析(一)https://www.jianshu.com/p/8bc4c5f4b19fFLEX源码分析二(网络监测swizzle)https://www.jianshu.com/p/ffb95f2cbda6FLEX源码分析三(网络监测记录FLEXNetworkRecorder)https://www.jianshu.com/p/66267dc922c5FLEX源码分析四(Systemlog)https://www.jianshu.
1<!DOCTYPEhtml>2<htmllang="en">3<head>4<metacharset="UTF-8">5<title><itle>6<style>7*{8margin:0;9padding:0;10
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><metahttp-equiv="X-UA-Compatible&qu
flex:将对象作为弹性伸缩盒显示inline-flex:将对象作为内联块级弹性伸缩盒显示两者都是使子元素们弹性布局,但是如果是flex,父元素的尺寸不由子元素尺寸动态调整,不设置时默认是100%,而inline-flex则会使父元素尺寸跟随子元素们的尺寸动态调整。
<html><head><metacharset="utf-8"><metaname="viewport"content="width=device-width"><title>test<itle><stylemedia="screen">.tab-head{list-style-type:no
有没有办法使用邮政编码找到径向距离?我的任务是搜索居住在指定距离内的所有用户.我知道用户的zipcodes.例如,距离当前位置25英里的用户.我有其他搜索类别,我正在使用mysql查询.我无法解决距离问题.我的后端是在PHP中Flex的前端和前端.对我来说最好的选择就是www.zip-codes.com