1.自定义组件应用
文档参考:https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
- //oamin\project.config.json
- {
- "description": "项目配置文件",
- "packOptions": {
- "ignore": [],
- "include": []
- },
- "setting": {
- "bundle": false,
- "userConfirmedBundleSwitch": false,
- "ignoreDevUnusedFiles": false,
- "ignoreUploadUnusedFiles": false,
- "urlCheck": true,
- "scopeDataCheck": false,
- "coverView": true,
- "es6": true,
- "postcss": true,
- "compileHotReLoad": false,
- "lazyloadPlaceholderEnable": false,
- "preloadBackgroundData": false,
- "minified": true,
- "autoAudits": false,
- "newFeature": false,
- "uglifyFileName": false,
- "uploadWithSourceMap": true,
- "useIsolateContext": true,
- "nodeModules": false,
- "enhance": true,
- "useMultiFrameRuntime": true,
- "useApiHook": true,
- "useApiHostProcess": true,
- "showShadowRootInWxmlPanel": true,
- "packNpmManually": false,
- "enableEngineNative": false,
- "packNpmRelationList": [],
- "minifyWXSS": true,
- "showES6CompileOption": false,
- "minifyWXML": true,
- "babelSetting": {
- "ignore": [],
- "disablePlugins": [],
- "outputPath": ""
- }
- },
- "compileType": "miniprogram",
- "libVersion": "2.19.4",
- "appid": "wx02e1b4896f9ba974",
- "projectname": "miniprogram-92",
- "condition": {},
- "editorSetting": {
- "tabIndent": "insertSpaces",
- "tabSize": 2
- }
- }
"tabs"> -
"tabs_title"> -
for="{{tabList}}" wx:key="id" class="title_item {{index==tabIndex?'item_active':''}}" bindtap="handleItemTap" data-index="{{index}}"> -
"margin-bottom:5rpx">{{item}} -
"width:30px" class="{{index==tabIndex?'item_active1':''}}"> -
-
-
"tabs_content"> -
-
-
-
- /* components/tabs/tabs.wxss */
- .tabs {
- position: fixed;
- top: 0;
- width: 100%;
- background-color: #fff;
- z-index: 99;
- border-bottom: 1px solid #efefef;
- padding-bottom: 20rpx;
- }
-
- .tabs_title {
- /* width: 400rpx; */
- width: 90%;
- display: flex;
- font-size: 9pt;
- padding: 0 20rpx;
- }
-
- .title_item {
- color: #999;
- padding: 15rpx 0;
- display: flex;
- flex: 1;
- flex-flow: column nowrap;
- justify-content: center;
- align-items: center;
- }
-
- .item_active {
- /* color:#ED8137; */
- color: #000000;
- font-size: 11pt;
- font-weight: 800;
- }
-
- .item_active1 {
- /* color:#ED8137; */
- color: #000000;
- font-size: 11pt;
- font-weight: 800;
- border-bottom: 6rpx solid #333;
- border-radius: 2px;
- }
-
- /* components/tabs/tabs.wxss */
- .tabs {
- position: fixed;
- top: 0;
- width: 100%;
- background-color: #fff;
- z-index: 99;
- border-bottom: 1px solid #efefef;
- padding-bottom: 20rpx;
- }
-
- .tabs_title {
- /* width: 400rpx; */
- width: 90%;
- display: flex;
- font-size: 9pt;
- padding: 0 20rpx;
- }
-
- .title_item {
- color: #999;
- padding: 15rpx 0;
- display: flex;
- flex: 1;
- flex-flow: column nowrap;
- justify-content: center;
- align-items: center;
- }
-
- .item_active {
- /* color:#ED8137; */
- color: #000000;
- font-size: 11pt;
- font-weight: 800;
- }
-
- .item_active1 {
- /* color:#ED8137; */
- color: #000000;
- font-size: 11pt;
- font-weight: 800;
- border-bottom: 6rpx solid #333;
- border-radius: 2px;
- }
-
- //oamin\pages\meeting\list\list.json
- {
- "usingComponents": {
- "tabs": "/components/tabs/tabs"
- }
- }
- // components/tabs/tabs.js
- Component({
-
- /**
- * 组件的属性列表
- */
- properties: {
- tabList:Object
- },
- /**
- * 组件的初始数据
- */
- data: {
-
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- handleItemTap(e){
- // 获取索引
- const {index} = e.currentTarget.dataset;
- // 触发 父组件的事件
- this.triggerEvent("tabsItemChange",{index})
- this.setData({
- tabIndex:index
- })
- }
- }
- })

2.其它界面的布局
"user"> -
"user-img" src="/static/persons/1.jpg"> -
"user-name">牛逼 -
"user-oper">修改 "info"> -
"item1"> -
"item-icon" src="/static/tabBar/sdk.png"> -
"item-title">我主持的会议 -
"item-num">1 -
"item-open">> -
-
"item2"> -
"item-icon" src="/static/tabBar/sdk.png"> -
"item-title">我参与的会议 -
"item-num">10 -
"item-open">> -
"info"> -
"item1"> -
"item-icon" src="/static/tabBar/sdk.png"> -
"item-title">我发布的会议 -
"item-num">1 -
"item-open">> -
-
"item2"> -
"item-icon" src="/static/tabBar/sdk.png"> -
"item-title">我参与的投票 -
"item-num">10 -
"item-open">> -
"info"> -
"item1"> -
"item-icon" src="/static/tabBar/sdk.png"> -
"item-title">消息 -
"item-num"> -
"item-open">> -
-
"item2"> -
"item-icon" src="/static/tabBar/sdk.png"> -
"item-title">设置 -
"item-num"> -
"item-open">> -
- /* pages/ucenter/index/index.wxss */
- .user {
- display: flex;
- align-items: center;
- border-bottom: 6px solid lightgray;
- }
-
- .user-img {
- width: 80px;
- height: 80px;
- margin: 10px;
- }
-
- .user-name {
- font-weight: 700;
- margin: 0 250rpx 0 50rpx;
- }
-
- .user-open {
- color: lightgray;
- }
-
- /* .info {} */
-
- .item1,.item2 {
- padding: 5px;
- display: flex;
- align-items: center;
- }
- .item1{
- border-bottom: 1px solid lightgray;
- }
- .item2 {
- border-bottom: 10px solid lightgray;
- }
- .item-icon {
- width: 40px;
- height: 40px;
- }
-
- .item-title {
- width: 500rpx;
- }
-
- .item-num {
- width: 60rpx;
- }
-
- /* .item-open {} */
