首页 > 其他分享 >uni-app 7个人中心页开发

uni-app 7个人中心页开发

时间:2022-10-14 16:01:00浏览次数:61  
标签:vue return default app free 开发 uni type icon


my.nvue 内容如下

<template>
<view class="page">
<free-nav-bar bgColor="bg-white">
<free-icon-button slot="right"><text class="iconfont font-md"></text></free-icon-button>
</free-nav-bar>

<free-list-item cover="../../../static/images/demo/demo6.jpg" title="呵呵" showRight coverSize="120">
<view class="flex flex-column">
<text class="text-dark font-lg font-weight-bold">呵呵</text>
<text class="text-light-muted font-md">微信号:VmzhbjzhV</text>
</view>
<view slot="right">
<text class="iconfont font-md text-light-muted"></text>
</view>
</free-list-item>

<free-divider></free-divider>
<free-list-item title="支付" showRight>
<text slot="icon" class="iconfont font-lg py-1"></text>
</free-list-item>

<free-divider></free-divider>
<free-list-item title="收藏" showRight>
<text slot="icon" class="iconfont font-lg py-1"></text>
</free-list-item>
<free-list-item title="相册" showRight>
<text slot="icon" class="iconfont font-lg py-1"></text>
</free-list-item>
<free-list-item title="表情" showRight>
<text slot="icon" class="iconfont font-lg py-1"></text>
</free-list-item>
<free-list-item title="设置" showRight>
<text slot="icon" class="iconfont font-lg py-1"></text>
</free-list-item>
</view>
</template>

<script>
import freeNavBar from "@/components/free-ui/free-nav-bar.vue";
import freeIconButton from "@/components/free-ui/free-icon-button.vue";
import freeListItem from "@/components/free-ui/free-list-item.vue";
import freeDivider from "@/components/free-ui/free-divider.vue";
export default {
components:{
freeNavBar,
freeIconButton,
freeListItem,
freeDivider
},
data() {
return {

}
},
methods: {

}
}
</script>

<style>

</style>

插件

free-list-item.vue
<template> 
<view class="bg-white flex align-stretch" hover-class="bg-light" @click="$emit('click')">
<view class="flex align-center justify-center py-2 px-3">
<slot name="icon"></slot>
<image :src="cover" v-if="cover" style="width: 75rpx;height: 75rpx;" mode="widthFix" :style="coverStyle"></image>
</view>
<view class="flex-1 border-bottom flex align-center justify-between">
<slot>
<text class="font-md text-dark">{{title}}</text>
</slot>
<view class="flex align-center pr-3" v-if="showRight">
<slot name="right"></slot>
<!-- 右 -->
<text class="iconfont text-light-muted font-md" ></text>
</view>
</view>
</view>
</template>

<script>
export default{
props:{
// 封面
cover:{
type:String,
default:""
},
// 标题
title:{
type:String,
default:""
},
// 显示右边
showRight:{
type:Boolean,
default:false
},
// 封面大小
coverSize:{
type:[String,Number],
default:75
}
},
computed:{
coverStyle(){
return `width:${this.coverSize}rpx;height:${this.coverSize}rpx;`;
}
}
}
</script>

<style>
</style>
free-nav-bar.vue
<template>
<view>
<view :class="getClass">
<!-- 状态栏 -->
<view :style="'height:'+statusBarHeight+'px;'"></view>
<!-- 导航 -->
<view class="w-100 flex align-center justify-between" style="height: 90rpx;">
<!-- 左边 -->
<view class="flex align-center">
<!-- 标题 -->
<text v-if="title" class="font-md ml-3" >{{getTitle}}</text>
</view>
<!-- 右边 -->
<view class="flex align-center">
<slot name="right">
<free-icon-button @click="search"><text class="iconfont font-md"></text></free-icon-button>
<free-icon-button @click="openExtend"><text class="iconfont font-md"></text></free-icon-button>
</slot>
</view>
<!--\ue6e3 \ue682 -->
</view>
</view>

<!-- 站位 -->
<view v-if="fixed" :style="fixedStyle"></view>

<!-- 扩展菜单 -->
<free-popup ref="extend" maskColor bottom :bodyWidth="320" :bodyHeight="525" bodyBgColor="bg-dark" transformOrigin="right top">
<view class="flex flex-column" style="width:320rpx;height: 525rpx;">
<view v-for="(item,index) in menus" :key="index" class="flex-1 flex align-center" hover-class="bg-hover-dark" @click="clickEvent(item.event)">
<text class="pl-3 pr-2 iconfont font-md text-white">{{item.icon}}</text>
<text class="font-md text-white">{{item.name}}</text>
</view>
</view>
</free-popup>
</view>
</template>

<script>
import freeIconButton from './free-icon-button.vue';
import freePopup from './free-popup.vue';
export default {
components: {
freeIconButton,
freePopup
},
props: {
title: {
type: String,
default: ''
},
fixed:{
type:Boolean,
default:false
},
noreadnum:{
type:Number,
default:0
},
bgColor:{
type:String,
default:"bg-light"
}
},
data() {
return {
statusBarHeight: 0,
navBarHeight: 0,
menus:[
{
name:'发起群聊',
event:"",
icon:"\ue633"
},
{
name:'添加好友',
event:"",
icon:"\ue65d"
},
{
name:'扫一扫',
event:"",
icon:"\ue614"
},
{
name:'收付款',
event:"",
icon:"\ue66c"
},
{
name:'帮助与反馈',
event:"",
icon:"\ue61c"
}
],
}
},
mounted() {
// 获取任务栏高度
// #ifdef APP-PLUS-NVUE
this.statusBarHeight = plus.navigator.getStatusbarHeight()
// #endif
this.navBarHeight = this.statusBarHeight + uni.upx2px(90)
},
computed: {
fixedStyle() {
return `height:${this.navBarHeight}px`;
},
getTitle(){
let noreadnum = this.noreadnum>0 ? '('+this.noreadnum+')' : '';
return this.title + noreadnum;
},
getClass(){
let fixed = this.fixed?"fixed-top":"";
return `${fixed} ${this.bgColor}`;
}
},
methods:{
openExtend(){
this.$refs.extend.show(uni.upx2px(415),uni.upx2px(150));
}
}
}
</script>

<style>

</style>
free-icon-button.vue
<template>
<view class="flex align-center justify-center"
hover-class="bg-hover-light" @click="$emit('click')"
style="height: 90rpx;width: 90rpx;">
<slot></slot>
</view>
</template>

<script>
export default {
props: {
icon: {
type: String,
default: ''
},
},
mounted() {
// #ifdef APP-PLUS-NVUE
// 加载公共图标库
const domModule = weex.requireModule('dom')
domModule.addRule('fontFace', {
'fontFamily': "iconfont",
'src': "url('/static/font_1365296_2ijcbdrmsg.ttf')"
});
// #endif
}
}
</script>

<style>
</style>

页面是酱紫的

uni-app 7个人中心页开发_javascript


感谢大家观看。我们下期再见。


标签:vue,return,default,app,free,开发,uni,type,icon
From: https://blog.51cto.com/u_15565664/5757144

相关文章

  • uni-app 9.2聊天信息设置页(二)
    主页面chat-set.nvue<template><viewstyle="background-color:#EDEDED;"><!--导航栏--><free-nav-bartitle="聊天信息"showBack:showRight="false"></free......
  • MAPPO学习笔记(2) —— 从MAPPO论文入手
    在有了上一节一些有关PPO算法的概念作为基础后,我们就可以正式开始对于MAPPO这一算法的学习。那么,既然要学习一个算法,就不得不去阅读提出这一算法的论文。那么本篇博客将从......
  • Flutter开发Cannot run with sound null safety报错
    问题描述今天在学习别人代码时,报了一个如下错误:/D:/flutter/.pub-cache/hosted/pub.dartlang.org/video_player_platform_interface-2.2.0/lib/messages.dart:4:1:Error:......
  • 高校垃圾分类APP技术服务支持
      高校垃圾分类app有助于创造更加美好的生活学习环境,培养学生的责任心和环保意识;有利于推动高校的生态文明建设,构建“绿色校园”,提升学校形象;有利于环境的保护,实现绿......
  • SpringBoot中Server层以及Mapper层常用注解
    4.Service层注解@Service注解一般写在业务层的接口实现类上,而不是接口上。4.1@Service@Service:@Service注解用于类上,标记当前类是一个service类,加上该注解会将当......
  • Unity 在模型上展示标签UI
    voidUpdate(){this.transform.LookAt(Camera.main.transform);}   在主摄像机下设置一个子摄像机,主摄像机CullingMask去掉显示UI。子摄像机Cul......
  • uniapp应用间实现通信,通过自定义广播实现
    uniapp应用间实现通信,通过自定义广播实现一、uniapp检测应用安装,并实现跳转至其他appif( plus.runtime.isApplicationExist({ //查看安卓系统手机有没有下载这款......
  • uniapp-vue3-ts实现 微信小程序-视频上下滑动
    公司需求,后端被迫学习...临时记录一下后续完善暂时不会组件式开发,只能采用选项式了<template><viewstyle="color:white;"><viewclass="swiper">......
  • 前端成神之路-移动web开发之响应式布局
    我的博客即将同步至OSCHINA社区,这是我的OSCHINAID:海仔技术驿站移动端WEB开发之响应式布局1.0响应式开发原理1.1响应式开发原理就是使用媒体查询针对不同宽度的设备进......
  • 《MiniPRO H750开发指南》第五十二章 FPU测试(Julia分形)实验
    第五十二章FPU测试(Julia分形)实验​本章我们将学习如何开启STM32H750的硬件FPU,并对比使用硬件FPU和不使用硬件FPU的速度差别,以体现硬件FPU的优势。​本章分为如下几个小节......