codeshare's People
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.