UNIAPP----picker组件的简易使用

直接上代码:

HTML:

JS:

	export default {
		data() {
			return {
				before_sp: '',
				sid: '',
				splList: [
					{id: 1, sp_name: '一手商品'},
					{id: 2, sp_name: '二手商品'}
				]
			}
		},
		methods: {
		spChange(e) {
			const index = e.target.value;
			this.before_sp = this.splList[index].sp_name;
			this.sid = this.splList[index].id;
		}
		},
	}

CSS:

  .first image {
  	width: 24rpx;
  	height: 24rpx;
  	position: absolute;
  	right: 20rpx;
  	top: 34rpx;
  }
  .beixuanxiang {
  	width: 30%;
  	height: 100%;
  	position: absolute;
  	right: 50rpx;
  	top: 0;
  	text-align: right;
  	line-height: 92rpx;
  	font-size: 24rpx;
  	color: #666;
  }

复制粘贴,直接运行。

你可能感兴趣的:(笔记)