GithubHelp home page GithubHelp logo

codeshare's People

Watchers

 avatar  avatar

codeshare's Issues

Category Grids

  <block wx:if="{{ categoryGrids.length > 0 }}">
    <view class="cc-bgcolor-fff" style="padding: 15px 0 10px 0; margin-bottom: 10px;">
      <block wx:for="{{ util.ArrayChunk(categoryGrids, 4) }}" wx:for-item="grid">
        <view class="cc-category-unit">
          <van-row>
            <block wx:for="{{ grid }}" wx:for-item="unit" wx:key="text">
              <van-col span="6">
                <view class="cc-center-align">
                  <navigator
                    url="{{ unit.url }}"
                    target="{{ unit.target ? unit.target : 'self' }}"
                    open-type="{{ unit.openType ? unit.openType : 'navigate' }}"
                    app-id="{{ unit.appId ? unit.appId : '' }}"
                    path="{{ unit.path ? unit.path : '' }}"
                    extra-data="{{ unit.extraData ? unit.extraData : null }}"
                    version="{{ unit.version ? unit.version : 'release' }}"
                    style="width: 60px; height: 60px; border-radius: 50%; display: inline-block;"
                  >
                    <image mode="widthFix" src="{{ util.getCdnUrl2(unit.src, 'style/200x200') }}" style="width: 60px; height: 60px; border-radius: 50%;"></image>
                  </navigator>
                </view>
                <view class="cc-center-align cc-font-13 cc-font-grey">{{ unit.text }}</view>
              </van-col>
            </block>
          </van-row>
        </view>
      </block>
    </view>
  </block>
.cc-category-unit:first-child {
  margin-bottom: 7px;
}
function ArrayChunk(arr, size) {
  if (!ArrayIsArray(arr)) {
    return [];
  }
  var arrs = [];
  while (arr.length > 0) {
    arrs.push(arr.splice(0, size));
  }
  return arrs;
}

function _getCdnUrl (version, path, suffix) {
  if (typeof path === 'undefined' || path === null) {
    return '';
  }

  var isHttp = path.slice(0, 4) === 'http';

  var arr = [
    isHttp ? '' : config['imageCdn' + version],
    path.charAt(0) === '/' ? path.slice(1) : path,
  ];

  if (suffix) {
    if (path.indexOf('x-oss-process') === -1) {
      arr.push('?x-oss-process=' + suffix);
    }
  }

  return arr.join('');
}

function getCdnUrl (path, suffix) {
  return _getCdnUrl('', path, suffix);
}

function getCdnUrl2 (path, suffix) {
  return _getCdnUrl(2, path, suffix);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.