vue如何利用flex布局实现TV端城市列表,下面web建站小编给大家详细介绍一下具体实现代码!
template代码如下:
<template> <div class="index-root-search-view-css" :clipChildren="false"> <img class="search-background-view-css" :src="searchImageData"/> <div class="search-bar-root"> <div class="index-root-search-title-css"> <span class="index-root-search-title-text-view-css"> {{ searchTitle }}</span> </div> <div class="search-bar"> <input class="search-input" v-model="citySearchResult" :placeholder="searchDefault" :key="searchTitle" @endEditing="endEditing" :focusable="true" ref="searchInput" :duplicateParentState="true" :enableFocusBorder="true"/> <img class="index-root-search-image-view-css" :src="searchIcon"> <span class="index-root-search-text-view-css" ref="textViewCity">{{searchDefaultKeyWord}}</span> </div> <div class="index-root-search-flex-view-css" :clipChildren="false" ref="citySearch"> <div class="search-city-button-view-css" v-for="(item,cityId) in hotCity" :focusable="true" :key="cityId" :ref="`hotRef${cityId}`" @focus="onFocus" :clipChildren="false"> <div class="icon-location-reactive" ref="searchLocation" :duplicateParentState="true" style="visibility: visible;margin-right: 20px" v-if="showHot && cityId===0"> <img src="@/assets/location.png" alt="" class="icon-location" showOnState="normal"> <img src="@/assets/location_hot_focus.png" alt="" class="icon-location" showOnState="focused"> </div> <span class="search-city-hot-text-iew-css" :duplicateParentState="true" showOnState="focused" ref="searchHotSelected" :style="{focusColor: focusHotTextColor,fontSize: textFontSize,fontWeight: textFontWeight,}">{{item.cityName}}</span> </div> <div class="search-city-empty" v-if="hotCity.length === 0"> <img src="@/assets/no_content.png" alt="" class="icon-no-connect"/> <p class="empty-txt">没有搜索结果~</p> </div> </div> </div> <loading-view style="width: 100px;height: 100px;position: absolute;left:960px;right:960px;top:500px;bottom:500px;align-self: center;align-items: center;justify-content: center" v-show="pageLoading"/> </div> </template>
js代码如下:
import searchImage from "@/assets/search_focus.png"; import searchBackGroundImage from "@/assets/index-bg-qing.jpg"; import {hotCity} from '@/views/contsants'; import {ESLaunchManager} from "@extscreen/es-core"; export default { name: "city_list", props: { searchKeyWord: { type: String, default: '', }, focusTextColor: { type: String, default: '#000000' }, focusHotTextColor: { type: String, default: '#00EFFF' }, textColor: { type: String, default: '#FFFFFF' }, textFontSize: { type: String, default: '30px' }, textFontWeight: { type: Number, default: 400 }, focusBackground: { orientation: 'TL_BR',//TOP_BOTTOM,TR_BL, RIGHT_LEFT, BR_TL, BOTTOM_TOP,BL_TR,LEFT_RIGHT,TL_BR, cornerRadius: [40, 40, 40, 40], normal: ['#00000000', '#00000000'], focused: ['#F5F5F5', '#F5F5F5'], }, }, data() { return { pageLoading: false, text: 'search city', search: '', searchIcon: searchImage, searchImageData: searchBackGroundImage, searchTitle: "切换城市", searchDefaultKeyWord: '搜索', searchDefault: '请输入城市名称首字母或全拼', focusColor: '#f5f5f5', citySearchResult: "", hotCity: [], cityName: "", cityId: "", showHot: true, params: '', } }, activated() { }, deactivated() { this.resetModel() }, mounted() { this.hotCity = hotCity; this.showHot = true; this.pageLoading = true //弹出软键盘 this.$refs.searchInput.focus() //搜索框默认获取焦点 this.setHideLoading() }, methods: { setHideLoading() { setTimeout(() => { this.pageLoading = false }, 500) }, onFocus(e) { this.focused = e.isFocused; this.$emit("onButtonFocused", e.isFocused); }, //输入内容之后请求城市 endEditing(e) { console.log("--resultData--", this.citySearchResult) }, onBackPressed() { ESLaunchManager.finishESPage(); }, resetModel() { this.citySearchResult = ""; this.hotCity = []; this.pageLoading = false; this.searchTitle = ""; this.searchDefaultKeyWord = ""; this.searchDefault = ""; }, } }
css代码如下:
.index-root-search-view-css { width: 1920px; height: 1080px; background-color: transparent; } .search-background-view-css { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-color: transparent; } .search-bar-root { display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 140px; } .index-root-search-title-css { flex-direction: column; align-items: center; justify-content: center; margin-bottom: 40px; } .search-bar-root .search-bar { background-color: #ffffff; width: 1000px; height: 100px; display: flex; justify-content: center; border-radius: 8px; } .search-input { width: 780px; border-radius: 8px; font-size: 36px; font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; color: #000000; margin-left: 40px; text-indent: 40px; } .index-root-search-image-view-css { position: absolute; width: 32px; height: 32px; top: 35px; bottom: 35px; right: 0; margin-right: 102px; text-align: center; } .index-root-search-flex-view-css { display: flex; flex-wrap: wrap; flex-direction: row; width: 1450px; margin-left: 245px; margin-right: 245px; margin-top: 40px; } .index-root-search-text-view-css { font-size: 30px; font-family: PingFangSC-Regular, PingFang SC; color: #000000; text-align: center; font-weight: 400; top: 0; bottom: 0; right: 0; position: absolute; margin-right: 30px; } .index-root-search-title-text-view-css { font-size: 70px; font-family: PingFangSC-Regular, PingFang SC; color: #ffffff; text-align: center; opacity: 1.0; } .search-city-button-view-css { width: 270px; height: 100px; background-color: rgba(0, 0, 0, .1); margin-right: 20px; margin-top: 40px; border-radius: 11px; border-width: 2px; border-color: rgba(255, 255, 255, 0.1); focus-background-color: #fff; } .search-city-button-view-css .city-sel-box { border-width: 2px; border-color: #32C5FF; } .icon-location-reactive { position: absolute; width: 26px; height: 34px; margin-left: 60px; margin-top: 30px; margin-bottom: 30px; } .icon-location { width: 26px; height: 34px; position: absolute; left: 0; top: 0; z-index: 9; } .search-city-hot-text-iew-css { width: 270px; height: 100px; background-color: rgba(50, 197, 255, 0.1); border-radius: 11px; border: 2px solid #32C5FF; font-size: 36px; font-family: PingFangSC-Regular, PingFang SC; text-align: center; color: white; } .search-city-empty { margin-top: 40px; width: 425px; display: flex; align-items: center; justify-content: center; flex-direction: column; margin-left: 535px; } .search-city-empty .icon-no-connect { width: 425px; height: 307px; } .search-city-empty .empty-txt { font-size: 32px; font-family: PingFangSC-Light, PingFang SC; font-weight: 300; color: #FFFFFF; margin-top: 60px; }
flex布局出现宽度动态扩展问题,flex设置固定宽度3个方法
display有哪些常用属性值,grid布局和flex布局的区别?
标签: flex布局
上面是“vue如何利用flex布局实现TV端城市列表”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3392.html
workflows工作流
- 荷塘月色ComfyUI工作流
- 一个穿过泥泞雷区的士兵ComfyUI工作流
- 一个可爱的口袋妖怪ComfyUI工作流
- 一个骷髅海盗船长ComfyUI工作流
- 一辆在泥潭中奔跑的布加迪ComfyUI工作流
- 一个孤独的斗篷人物站在一座巨大的雕塑旁
- 乡村枯树黄花comfyui工作流
- 一只被水晶包围的小动物ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!