当前位置:网站首页>Uniapp realizes horizontal click and slide menu
Uniapp realizes horizontal click and slide menu
2022-07-23 15:05:00 【Two faces confused】
html Code
<scroll-view class="scroll-view" scroll-x="true">
<block v-for="(item,index) in list" :key="item">
<view class="scroll-content">
<view class="list-item" @click="getCollectList(item.type)" :data-type='item.type'>
<text :style="nowType==item.type?selectedStyle.text:''">{
{item.name}}</text>
<view :style="nowType==item.type?selectedStyle.border:''"></view>
</view>
</view>
</block>
</scroll-view>
js Code
<script>
import {
reactive,
ref,
getCurrentInstance,
onMounted
} from "vue"
export default {
setup() {
let nowType = ref("");
// Style design when selected
const selectedStyle = reactive({
border: {
borderBottom: "6rpx solid #FF5D37"
},
text: {
color: '#FF5D37',
fontWeight: 'bold'
}
})
const {
proxy
} = getCurrentInstance();
const list = reactive([{
name: ' Room information ',
type: 'house'
}, {
name: ' Recruitment information ',
type: 'job'
}, {
name: ' Talent information ',
type: 'resume'
}, {
name: ' Item information ',
type: 'commodity'
}, {
name: ' Agriculture, forestry and fishing ',
type: 'farming'
}, {
name: ' Transfer of business ',
type: 'transfer'
}, {
name: ' Need to inquire ',
type: 'ask'
}, {
name: ' Local promotion ',
type: 'promote'
}, {
name: ' Merchant shop ',
type: 'store'
}]);
function getCollectList(type) {
nowType.value = type;
}
return {
list
}
}
}
</script>
css style
.scroll-view {
margin: 20rpx 0;
display: flex;
white-space: nowrap;
.scroll-content {
display: inline-block;
width: 25%;
}
}
边栏推荐
猜你喜欢

Simulation of BOC modulation signal acquisition based on MATLAB

Activity的启动流程

c语言:深度刨析const关键字

Cmake notes

Deep learning single image 3D face reconstruction

爬虫中selenium实现自动给csdn博主文章点收藏

基于nextcloud构建个人网盘

多项式承诺Polynomial commitment方案汇总

Kettle實現共享數據庫連接及插入更新組件實例

Educational Codeforces Round 132 (Rated for Div. 2) D. Rorororobot
随机推荐
QT document reading notes audio example analysis
Postgresql快照优化Globalvis新体系分析(性能大幅增强)
The pit trodden by real people tells you to avoid the 10 mistakes often made in automated testing
用FFT加速特殊矩阵的矩阵向量乘运算
How to realize 485 wireless communication between multiple sensors and Siemens PLC?
他山之石 | 阿里多模态知识图谱探索与实践
Typora图床配置详细教程
Mathematical function of MySQL function summary
百度工程师眼中的云原生可观测性追踪技术
Reflection invokes transaction methods, resulting in transaction invalidation
AVX指令集加速矩阵乘法
Zhongwang CAD professional 2022 software installation package download and installation tutorial
supervisord安装使用
基于matlab的BOC调制信号捕获仿真
Version correspondence between numpy and pytorch
js拖拽元素
mysql唯一索引无重复值报错重复
Simulation of BOC modulation signal acquisition based on MATLAB
Russia hopes to effectively implement the "package" agreement on the export of agricultural products
Qt|模仿文字浮动字母