当前位置:网站首页>[bottom pop-up selector] uniapp picker component - scroll selector popped up at the bottom
[bottom pop-up selector] uniapp picker component - scroll selector popped up at the bottom
2022-07-02 00:32:00 【Ma Xiaotiao's coding advanced road】
One 、 The effect to be achieved , As shown in the figure below :


Two 、 Code :
<template>
<view>
//mode : selector Is the most common selector ,[ Specific reference documentation .](https://uniapp.dcloud.io/component/picker.html)
//range : Array to bind .
//range-key : Which of the array do you want to display in the pop-up box key value . For example, I want to display in the array color title Value , It can't be written as id.
//@change : This callback function will be triggered when you click Select .
<picker @change="colorChange" :value="colorIndex" :range="colorList" range-key="title">
<view class="uni-input">{
{colorList[colorIndex].title}}</view>
</picker>
</view>
</template>
<script> export default {
data() {
return {
// Selected color subscript colorIndex:0, // stay picker The color of the selected item in the list id color_id: '', // Color list data ( Fake data , You can send a request to get the real background data in the interface function ) colorList:[ {
id: 1, title: ' Red '}, {
id: 2, title: ' green '}, {
id: 3, title: ' Blue '} ], } }, onLoad() {
this.getCaseList() }, methods: {
// Color screening colorChange(e){
this.colorIndex = e.detail.value this.getCaseList() }, // List of cases - Interface getCaseList() {
var that = this; that.page = 1; var params = {
// Color id color_id: that.colorList.length>0? that.colorList[that.colorIndex].id:'', page: that.page, limit: that.limit } this.$api.appPlateForm('POST', 'example/index', params, function(res) {
if (res.code == 200) {
that.colorList = res.data.color // Color that.colorList.unshift({
id:'',title:' Color '}); if(res.data.data.length>0){
that.caselist = res.data.data; that.page++ }else{
that.caselist =[]; } that.$forceUpdate(); } }, function(err) {
uni.showToast({
icon: 'none', title: err.msg }) }); }, }, } </script>
ending~
边栏推荐
- 数据库--SqlServer详解
- 【模板】自适应辛普森积分
- Leetcode skimming: stack and queue 06 (top k high-frequency elements)
- leetcode96不同的二叉搜索樹
- Jielizhi Bluetooth headset quality control and production skills [chapter]
- 【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“
- [template] adaptive Simpson integral
- GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
- Ldr6035 smart Bluetooth audio can continuously charge and discharge mobile devices
- JS——图片转base码 、base转File对象
猜你喜欢

起床困难综合症(按位贪心)

Using multithreaded callable to query Oracle Database

Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?

Guide d'installation du serveur SQL

Kuberntes cloud native combat high availability deployment architecture

export default 导出的对象,不能解构问题,和module.exports的区别

九州云与英特尔联合发布智慧校园私有云框架,赋能教育新基建

Openvino model performance evaluation tool DL workbench
![Jielizhi, production line assembly link [chapter]](/img/1d/d1736fad33c428e61f450aad512ce0.png)
Jielizhi, production line assembly link [chapter]

LDR6035智能蓝牙音响可对手机设备持续充放电方案
随机推荐
Jielizhi, production line assembly link [chapter]
【CTF】bjdctf_2020_babystack2
实例讲解将Graph Explorer搬上JupyterLab
Talents come from afar, and Wangcheng district has consolidated the intellectual base of "strengthening the provincial capital"
What is the purpose of ERP project implementation plan?
Is it safe and reliable to open an account in Caixue school and make new debts?
SQL Server 安裝指南
JS -- image to base code, base to file object
九州云与英特尔联合发布智慧校园私有云框架,赋能教育新基建
From 20s to 500ms, I used these three methods
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
Download the online video m3u8 tutorial
Asp .NetCore 微信订阅号自动回复之文本篇
Which app is better and more secure for stock mobile account opening
Is it safe to choose mobile phone for stock trading account opening in Beijing?
Relevant settings of wechat applet cache expiration time (recommended)
Leetcode skimming: stack and queue 03 (valid parentheses)
Some understandings of graph convolution neural network r-gcn considering relations and some explanations of DGL official code
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
How to type spaces in latex