zoukankan      html  css  js  c++  java
  • 微信小程序知识集锦

    1、自定义属性/获取属性值

    自定义属性:

    <view bindtap='shopPost' data-myid='item.goods_id' ></view>

    获取属性:

    shopPost:function(e){ 
      //var postId = e.Target.dataset.myid;
      var postId = e.currentTarget.dataset.myid
    }

    2、传参/获取参数


    获取参数并传参

    onPostTap:function(e)
    {
      //获取自定义myid
      let postId=e.currentTarget.dataset.myid;
      wx.navigateto({
      url:'detail?id='+postId
    })
    }

    detail页面接收参数值:

    onLoad:function(options)
    {
        let postId=options.id;
    }

    3,Image 图片实现宽度100%,高度自适应

    将宽带设置为100%,添加属性 mode="widthFix",如:

    <image style=" 100%;" src="../../images/hello.png" mode="widthFix">

    参考文档:
    https://www.w3cschool.cn/weixinapp/1k7h1ug9.html

  • 相关阅读:
    PHP创建socket服务
    linux配置PS1
    几个常用的linux命令
    MongoDB的分片集群搭建
    django-admin 配置
    django使用mysql数据库
    Django知识
    docker 监控之 cadvisor
    shell 拾遗
    shell 基数数值方法
  • 原文地址:https://www.cnblogs.com/softwyy/p/9006796.html
Copyright © 2011-2022 走看看