Home > WeChat Applet > Mini Program Development > Detailed explanation of WeChat mini program development and self-made widget example code

Detailed explanation of WeChat mini program development and self-made widget example code

高洛峰
Release: 2017-03-14 17:36:06
Original
2250 people have browsed it

This article mainly explains in detail the relevant information on the WeChat mini program development of self-made widget example codes. The self-made widgets can be used in projects. Friends in need can refer to

WeChat mini program production of widgets

Some common things in our daily life can be encapsulated into components and then used on various pages. For small programs, we can also encapsulate some public things we need.

Here we explain a small plug-in.

Detailed explanation of WeChat mini program development and self-made widget example code

Detailed explanation of WeChat mini program development and self-made widget example code

As shown in the picture above, a small plug-in, click to expand, when click to close, buttonclosure.

WXML of the page (APP.wxml)

<template name="widget-dialog-iconList">
  <view class="com-widget-iconList {{close==1?&#39;hideImg&#39;:&#39;&#39;}}" style="display:flex;flex-direction:row;">
    <view style="display:flex;flex-direction:row;">
      <view class="left-icon" style="display:flex;flex-direction:row;">
        <view class="left-circle"></view>
        <image class="icon1" src="http://m.dev.vd.cn/static/xcx/v1/goo/md_logo.png"></image>
      </view>
      <view class="middle_icon " style="display:flex;flex-direction:row;">
        <navigator url="../tua/home">
          <view class="section1">
            <view><image class="icon2" src="http://m.dev.vd.cn/static/xcx/v1/goo/firsticon.png"></image></view>
            <view class="text">首页</view>
          </view>
        </navigator>
        <navigator url="../ord/list">
          <view class="section2">
            <view><image class="icon2" src="http://m.dev.vd.cn/static/xcx/v1/goo/orderIcon.png"></image></view>
            <view class="text">订单</view>
          </view>
        </navigator>
        <navigator url="../usr/center">
          <view class="section3">
            <view><image class="icon3" src="http://m.dev.vd.cn/static/xcx/v1/goo/myself.png"></image></view>
            <view class="text">我的</view>
          </view>
        </navigator>
        <view class="right-icon" style="display:flex;flex-direction:row;">
          <image class="iconright" src="http://m.dev.vd.cn/static/xcx/v1/goo/delAllIcon.png" bindtap="closeAllIcon"></image>
        </view>
      </view>
 
    </view>
  </view>
  <view class="iconOnly {{close==0?&#39;hideImg&#39;:&#39;&#39;}}">
    <image class="iconOnlyPic" src="http://m.dev.vd.cn/static/xcx/v1/goo/md_logo.png" bindtap="showAllIcon"></image>
  </view>
</template>
Copy after login

This is mainly the surface display effect of the plug-in. Just write it in the