Commit 4d886b4b authored by Damon's avatar Damon

完工页面-scroll-view方案

parent 220595a7
;
(function() {
let NODE_ENV = 'dev'; // dev:开发环境 | test:测试环境 | prod:生产环境
let NODE_ENV = 'test'; // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null;
if (process.env.NODE_ENV === "development") {
if (NODE_ENV === 'dev') {
......
<!-- ******************* 单个下拉选择 ******************* -->
<template>
<view class="xh-select" :style="{'width': fieldsWidth}">
<u-input :value="text" disabled @click="show=true" :placeholder="placeholder" :placeholder-style="placeholderStyle"
<!-- <u-input :value="text" disabled @click="show=true" :placeholder="placeholder" :placeholder-style="placeholderStyle"
:custom-style="customStyle" :clearable="false"></u-input>
<u-select :list="settings" v-model="show" @confirm="actionSheetCallback" safe-area-inset-bottom></u-select>
<u-icon class="input-icon" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
<u-icon class="input-icon" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon> -->
<view class="u-flex u-row-between picker-common">
<picker mode="selector" :value="index" range-key="label" :range="settings" @click="show = true" @change="pickerChange" class="u-flex-1">
<view class="txt">{{text}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
</view>
</template>
......@@ -68,19 +75,25 @@
'font-size':'26rpx',
'height': '76rpx'
}
},
fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
},
fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
},
},
watch: {},
mounted() {},
methods: {
actionSheetCallback(event) {
const id = event[0].value
actionSheetCallback(event) {
const id = event[0].value
this.dataValue = id
this.valueChange(id)
}
},
pickerChange(data) {
const index = data.detail.value
const id = this.item.fieldsOptions[index].key
this.dataValue = id
this.valueChange(id)
},
}
}
</script>
......@@ -95,5 +108,17 @@
color: #2272FF;
}
}
.picker-common {
min-height: 35px;
background-color: #F4F5F7;
border-radius: 6px;
color: #333333;
padding-left: 10px;
padding-right: 12px;
width: 100%;
height: 38px;
.txt {
font-size: 14px;
}
}
</style>
<!-- ******************* 单级/多级 选择 ******************* -->
<template>
<view class="picker-box" :style="{'width': fieldsWidth}">
<view class="u-flex u-row-between text-view" @click="openPicker">
<!-- <view class="u-flex u-row-between text-view" @click="openPicker">
<view class="txt u-flex-1 text-title">{{text||''}}</view>
<u-icon class="input-icon" color="#2272FF" :name="showPicker ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
<u-picker v-model="showPicker" range-key="label" @columnchange="columnchange" :mode="isNotMulti?'selector':'multiSelector'" @confirm="pickerConfirm" :range="settings"></u-picker>
<u-picker v-model="showPicker" range-key="label" @columnchange="columnchange" :mode="isNotMulti?'selector':'multiSelector'" @confirm="pickerConfirm" :range="settings"></u-picker> -->
<view class="u-flex u-row-between picker-common">
<picker :mode="isNotMulti?'selector':'multiSelector'" :value="index" range-key="label" :range="settings" @click="showPicker = true" @change="pickerChange" class="txt u-flex-1">
<view>{{text}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="showPicker ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
<!-- :default-selector='[0, 1]' -->
<u-toast ref="uToast" />
</view>
......@@ -57,7 +63,8 @@
isNotMulti:true,
showPicker:false,
settings:[],
measure:[]
measure:[],
index: ''
}
},
computed: {
......@@ -68,9 +75,9 @@
val = data[0].measureTypeName + "-" + data[0].measureName
}
return val
},
fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
},
fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
},
},
watch: {
......@@ -145,6 +152,18 @@
}
this.valueChange(JSON.stringify(result))
},
pickerChange(data) {
this.showPicker = false
this.index = data.detail.value
let result = []
if(this.isMulti){// 维修
}else{// 安装
result.push(this.measure[this.index])
}
this.valueChange(JSON.stringify(result))
},
columnchange(data){
// // 树列改变时进行联动操作
// const {column ,index} = data
......@@ -155,6 +174,19 @@
}
</script>
<style lang="scss" scoped>
.picker-common {
min-height: 35px;
background-color: #F4F5F7;
border-radius: 6px;
color: #333333;
padding-left: 10px;
padding-right: 12px;
width: 100%;
height: 38px;
.txt {
font-size: 14px;
}
}
.text-view {
background-color: #F4F5F7;
border-radius: 12rpx;
......
<!-- ******************* 输入框 ******************* -->
<template>
<view class="picker-box">
<view class="u-flex u-row-between" @click="openPicker">
<!-- <view class="txt">{{item.fieldsTitle}}</view> -->
<!-- <view class="u-flex u-row-between" @click="openPicker">
<view class="txt u-flex-1">{{dataValue||'请选择时间'}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> -->
<!-- <u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker> -->
<view class="u-flex u-row-between">
<picker mode="date" :value="dataValue" @change="bindDateChange" class="txt u-flex-1">
<view>{{dataValue}}</view>
</picker>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker>
<!-- <u-picker v-model="showPicker" :rangeKey="rangeKey" @columnchange="columnchange" mode="multiSelector" @confirm="pickerConfirm" :default-selector='[0, 1]' :range="settings"></u-picker> -->
</view>
</template>
......@@ -29,19 +33,10 @@
minute: false,
second: false,
timestamp: true,
}
}
},
computed: {
type() {
if (this.item && this.item.fieldsType == 'password') {
return this.item.fieldsType
} else {
return 'text'
}
},
date: '请选择',
}
},
watch: {},
mounted() {},
methods: {
openPicker() {
......@@ -53,6 +48,11 @@
this.dataValue = dataValue
this.valueChange(dataValue)
},
bindDateChange: function(e) {
const value = e.target.value
this.dataValue = value
this.valueChange(value)
}
}
}
</script>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment