当前位置:网站首页>[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~
边栏推荐
- Selectively inhibiting learning bias for active sampling
- Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
- Vue force cleaning browser cache
- 数据库--SqlServer详解
- 股票开户哪个证券公司比较安全
- ERP项目施行计划的目的是什么?
- Window sorting functions rank and deny for SQL data analysis_ rank、raw_ Number and lag, lead window offset function [usage sorting]
- 牛客-练习赛101-推理小丑
- Kyushu cloud and Intel jointly released the smart campus private cloud framework, enabling new infrastructure for education
- 智能运维实战:银行业务流程及单笔交易追踪
猜你喜欢

Practical calculation of the whole process of operational amplifier hysteresis comparator

Database -- sqlserver details
![[embedded system course design] a single key controls the LED light](/img/c9/076618208bbab0b95faa5a7e644a07.png)
[embedded system course design] a single key controls the LED light

Leetcode skimming: stack and queue 03 (valid parentheses)

The origin of usb-if Association and various interfaces

PWN attack and defense world cgpwn2

What does open loop and closed loop mean?

Windows installation WSL (II)

数据分析方法论与前人经验总结【笔记干货】
![Comprehensive usage and case questions of sub query of SQL data analysis [patient sorting]](/img/24/d9a48a0f76cde65421edda04d0f854.png)
Comprehensive usage and case questions of sub query of SQL data analysis [patient sorting]
随机推荐
股票开户哪个证券公司比较安全
How do Lenovo computers connect Bluetooth headsets?
UDS bootloader of s32kxxx bootloader
Bc35 & bc95 onenet mqtt (old)
Intelligent operation and maintenance practice: banking business process and single transaction tracking
449-原码、补码、反码
PWN attack and defense world cgpwn2
Openvino model performance evaluation tool DL workbench
微信小程序缓存过期时间的相关设置(推荐)
Leetcode skimming: stack and queue 01 (realizing queue with stack)
Cmake engineering related
PHP reads ini or env type configuration
Mysql database driver (JDBC Driver) jar package download
I want to ask, which is the better choice for securities companies? I don't understand. Is it safe to open an account online now?
Halcon knowledge: an attempt of 3D reconstruction
Use the htaccess file to prohibit the script execution permission in the directory
Windows installation WSL (II)
【CTF】bjdctf_ 2020_ babystack2
Kuberntes cloud native combat high availability deployment architecture
【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“