当前位置: 首页 > wzjs >正文

视频网站怎么做网站引流地推团队联系方式

视频网站怎么做网站引流,地推团队联系方式,wordpress数据库导出工具,网站开发 手机 电脑目录 一、基本概述二、基本使用三、插槽 一、基本概述 在项目的开发过程中,页面上井场会出现一些通用的内容,例如头部的导航栏,如果我们每一个页面都去写一遍,那实在是太繁琐了,所以,我们使用组件来解决这…

目录

  • 一、基本概述
  • 二、基本使用
  • 三、插槽


一、基本概述

在项目的开发过程中,页面上井场会出现一些通用的内容,例如头部的导航栏,如果我们每一个页面都去写一遍,那实在是太繁琐了,所以,我们使用组件来解决这一难题。

二、基本使用

下面的案例中,我们定义一个用户信息展示的组件,通过传递一个对象来展示用户的头像以及姓名。
在这里插入图片描述
首先我们需要定义一个用户信息展示的组件user-info,uniapp中定义组件需要定义在根目录下的components中

<template><view class="box"><image :src="userImage" mode="aspectFill" class="user-image"></image><view class="user-name">{{userName}}</view></view>
</template><script setup>
import { computed } from 'vue';const props = defineProps({userName: {type: String, default: "匿名"},userImage: {type: String, default: "../../../static/logo.png"},obj: {type: Object, default() {return {userName: "匿名", userImage: "../../../static/logo.png"}}}
})
const userNameT = computed(() => props.userName + "@")
</script><style lang="scss" scoped>
.box {margin: 5rpx;width: 100%;height: 250rpx;background-color: #ccc;display: flex;flex-direction: column;align-items: center;justify-content: center;.user-image {width: 200rpx;height: 200rpx;}.user-name {margin-top: 5rpx;width: 100%;text-align: center;font-size: 14rpx;}
}
</style>

在主页面调用组件,uniapp会自动检索components下面的组件,所以在页面中不需要引入

<template><view class="box"><page-head title="component 组件"></page-head><view class="uni-padding-wrap uni-common-mt uni-flex uni-row uni-container"><user-info v-for="item in userList" :user-name="item.userName" :user-image="item.userImage"></user-info></view></view>
</template><script setup>
import { ref } from 'vue';const userList = ref([{userName: "张三", userImage: "../../../static/logo.png"},{userName: "李四", userImage: "../../../static/java.jpeg"},{userName: "王五", userImage: "../../../static/mybatis.png"},{userName: "赵六", userImage: "../../../static/mysql.jpeg"},
])
</script><style lang="scss" scoped>.uni-container {-webkit-flex-wrap: wrap;flex-wrap: wrap;}
</style>

三、插槽

我们在定义组件的时候,有的时候个别部分是不通用的,如果都单独创建一个特定的组件,那将会失去组件的真实意义,因此,vue为我们提供了slot插槽标签帮我们解决了这一问题,将单独部分进行定制。
在这里插入图片描述
首先我们需要定义一个标题组件,在特定的区域,我们使用slot插槽进行留白。

<template><view class="box"><view class="box-title-t">{{title}}</view><view><slot name="icon"></slot></view></view>
</template><script setup>
const props = defineProps({title: {type: String, default: "这是啥?"}
})</script><style lang="scss" scoped>
.box {padding: 0 10rpx;width: 100%;height: 100rpx;display: flex;flex-direction: row;align-items: center;justify-content: space-between;.box-title-t {color: #000;font-weight: 700;}
}
</style>

在主页面中我们引入组件,并对组件进行定制,这里需要注意的是,插槽里面的样式要写在主页面中,如果写在组件里面,那会成为公共样式。

<template><view class="box"><page-head title="component 组件"></page-head><view class="uni-padding-wrap uni-common-mt uni-flex uni-row uni-container"><title-info title="精彩呈现" class="title-class"><template #icon><image src="/static/logo.png" mode="aspectFill"></image></template></title-info><title-info title="其他内容" class="title-class"><template #icon><text>More+</text></template></title-info></view></view>
</template><script setup></script><style lang="scss" scoped>.title-class {image {width: 50rpx;height: 50rpx;}text{color: #ccc;}}
</style>
http://www.dtcms.com/wzjs/176049.html

相关文章:

  • 做网站图片无法显示的原因电子商务主要学什么内容
  • 厦门手机网站建设常州网络推广哪家好
  • 动态网站开发需求开一个免费网站
  • 上高做网站公司上海专业seo公司
  • 做网站需要多少钱 做seo优化操作
  • 绿色网站配色网站广告调词平台
  • 建设网站有什么网站网店如何做推广
  • 网站建设的模块互联网企业营销策略
  • Css网站引导竞价培训课程
  • 网站托管服务商seo顾问培训
  • 网站建设的规划书百度怎么推广产品
  • 网站域名是什么意思网页设计一般用什么软件
  • wordpress模板网站导航seo方式包括
  • 百度做的网站 后台管理怎么进入江苏百度推广代理商
  • ps做网站好看的logoseo优化有百度系和什么
  • 做网站一般什么问题山东济南最新消息
  • 沧州网站设计哪家好拼多多seo怎么优化
  • 建筑网站开发yandex搜索引擎
  • 聊城市东昌府区建设局网站外贸网站建站和推广
  • 厦门北京网站建设公司哪家好外链代发2分一条
  • 织梦通用企业网站模板佛山快速排名seo
  • 网站业务怎么做的百度统计怎么用
  • dw动态网站怎么做搜索框东莞seo托管
  • 网站开发项目教程笔记域名解析ip地址
  • 电子商务网站建设的策划书网络营销案例ppt课件
  • 怎么样免费做网站推广引流吸引人的标题
  • php做的网站首页是什么文件杭州seo俱乐部
  • php做学校网站免费下载seo实战密码在线阅读
  • 房产如何做网站百度收录的网站
  • 黄骅做网站价格互联网广告怎么做