zoukankan      html  css  js  c++  java
  • 小程序开发的心得

    主要研究了icon,text,process三个组件

    1,icon

         这个还挺好玩的,比iconfont好用的多,但是就是设置的样式挺少的,提供的选择不是很多,用起来也还行,就用icon标签就好了,后面跟上icon的size,type,color,一个icon图标就出来了,提供的样式请参考官网:https://mp.weixin.qq.com/debug/wxadoc/dev/component/icon.html

         ps:我在学习icon的时候,最有意思的事,是我学会了小程序开发里面的循环,感觉挺不错的,格式:

    <view class="group">

      <block wx:for="{{iconSize}}">

        <icon type="success" size="{{item}}"/>

      </block>

    </view>

    2,text

         这个没什么,很平常的一个组件,显示文字,主要是看他的时候又学了一次,点击事件;

    <view class="btn-area">

      <view class="body-view">

        <text>{{text}}</text>

        <button bindtap="add">add line</button>

        <button bindtap="remove">remove line</button>

      </view>

    </view>

     

    var initData = 'this is first line\nthis is second line'

    var extraLine = [];

    Page({

      data: {

        text: initData

      },

      add: function(e) {

        extraLine.push('other line')

        this.setData({

          text: initData + '\n' + extraLine.join('\n')

        })

      },

      remove: function(e) {

        if (extraLine.length > 0) {

          extraLine.pop()

          this.setData({

            text: initData + '\n' + extraLine.join('\n')

          })

        }

      }

    })

     

    在wxml文件中定义事件,在js中的page中定义函数处理程序,完美!

    tips:text的长按复制功能还没有实现,使用的时候注意;

    3.process

           这个挺好的,今天我刚刚实现了一个pc端的文件上传功能,刚好也用到了进度条,但是微信中的用法,明显更简单一些,提供了percent, show-info,stroke-width,coloe,active等五个属性,操作非常方便

    <progress percent="20" show-info />

    <progress percent="40" stroke-width="12" />

    <progress percent="60" color="pink" />

    <progress percent="80" active />

     

     

  • 相关阅读:
    document.getElementById(“id”)与$("#id")的区别
    sqlserver 无法打开备份文件a.bak
    xnconvert 图片转换工具
    基于jQuery的 h5移动端抽奖页面插件
    nodeJS 简单启动express服务器
    jquery 按钮切换插件
    微信判断手机有没有APP,有则打开,没有则跳到应用商城
    jQuery 文字向上轮播
    Node.js制作爬取简书内容的爬虫
    jquery手机端轮播图,点击放大手动轮播
  • 原文地址:https://www.cnblogs.com/boboweiqi/p/6575294.html
Copyright © 2011-2022 走看看