style="direction:inherit"的作用

本文介绍CSS中direction属性的作用及用法,包括ltr、rtl和inherit三个取值的意义,并解释了这些选项如何影响文本的流向。此外还提到了unicode-bidi属性的应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

语法:direction : ltr | rtl | inherit

取值:

ltr : 默认值。文本从左到右流入

rtl : 文本从右到左流入

inherit : 文本流入方向由继承获得

说明:

用于设置文本流入的方向。请参阅对象的 dir 属性。

此属性不会影响拉丁文的字母数字字符,它们总是以 ltr 值被呈递。

但是此属性会作用于拉丁文的标点符号。假如您想应用此属性于内联文本,您必须设定 unicode-bidi 属性为 embed 或 bidi-override 。

此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。对应的脚本特性为 direction 。

<template> <Layout :have-tab-bar="false" icon=""> <span slot="title" class="topBarTitle">我的项目</span> <view class="container"> <view class="containerBody"> <view class="search"> <view class="text">数据</view> </view> <view class="history_item"> <view style="padding:10px"> <view style="color: #82D4FF;margin-bottom: 38rpx;display: flex;justify-content: space-between"> 项目基本信息 <view style="width: 25px;height: 25px;"> <uni-icons @click="editData" type="compose" size="20" color="#fff"></uni-icons> </view> </view> <view style="display: flex"> <view> <view class="info"> <view class="label">项目名称</view> <view>{{name}}</view> </view> <view class="info"> <view class="label">项目地址</view> <view>{{projAddr}}</view> </view> </view> </view> <view style="color: #82D4FF;margin-bottom: 38rpx">项目基本情况</view> <view style="display: flex;color: #fff;padding-right:18rpx;padding-top: 18rpx;"> <view class="project"> <view style="display: flex"> <view class="project-item"> <view style="width: 118px"> 盾构机直径m </view> <view class="project-item-input"> <input disabled :value="diameter" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="project-item"> <view class="project-item-num" style="white-space: nowrap"> 掘进速度cm/min </view> <view class="project-item-input"> <input disabled :value="speed" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="project-item"> <view class="project-item-num"> 送泥比重g/cm³ </view> <view class="project-item-input"> <input disabled :value="propor" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> </view> <view style="display: flex;color: #fff;padding-right:18rpx;padding-top: 18rpx;"> <view class="project"> <view style="display: flex"> <view class="project-item"> <view class="project-item-num"> 每小时送泥流量 <view class="unit">g/cm³</view> </view> <view class="project-item-input"> <input disabled :value="timesend" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="project-item" style="margin-top: 42rpx"> <view class="project-item-num"> 管片宽度m </view> <view class="project-item-input"> <input disabled :value="width" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="project-item" style="margin-top: 42rpx"> <view class="project-item-num"> 日掘进环数 </view> <view class="project-item-input"> <input disabled :value="dayTunnelleCylindernumber" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> </view> <view style="display: flex;color: #fff;padding-right:18rpx;padding-top: 18rpx;"> <view class="project"> <view style="display: flex"> <view class="project-item"> <view class="project-item-num"> 每小时排泥流量 <view>cm/min</view> </view> <view class="project-item-input"> <input disabled :value="hourSpoildisposal" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> </view> <view class="situation" style="height: 400px;"> <view class="every"> <view>各地层基本情况</view> <!-- <view @click="addStratum">--> <!-- <uni-icons type="plusempty" size="16" color="#fff"></uni-icons>--> <!-- </view>--> </view> <view class="item" v-for="(item, index) in stratumList" :key="index"> <view style="color: #fff;margin-left: 10px;display: flex;">地层编号: <input disabled :value="item.num" style="background-color: #303E63;margin-left: 10px;border-radius: 5px" /> <!-- <view style="width: 25px;height:25px;margin-left:10px;background-color: #303E63;color: #B6BAFF;border-radius: 6px;text-align: center">{{ index + 1}}</view>--> </view> <view style="color: #fff;margin-left: 10px;margin-top:10px;display: flex;">地层名称: <input disabled :value="item.name" style="background-color: #303E63;margin-left: 10px;border-radius: 5px" /> <!-- <view style="width: 25px;height:25px;margin-left:10px;background-color: #303E63;color: #B6BAFF;border-radius: 6px;text-align: center">{{ index + 1}}</view>--> </view> <view class="situation_item" style="height: 35px;"> <view class="stratum"> <view>地层特性</view> <view class="stratum-select"> <view> <uni-section> <uni-data-select :value="item.features1" :localdata="characterOne" :disabled="disabled" style="width: 100%;"></uni-data-select> </uni-section> </view> <view v-if="value === 0" style="margin-left: 10px"> <uni-section> <uni-data-select :value="item.features2" :localdata="characterTwo" :disabled="disabled" style="width: 100%;"></uni-data-select> </uni-section> </view> </view> </view> </view> <view class="situation_item" style="height: 35px;"> <view class="stratum"> <view> 地层比重g/cm³ </view> <view class="stratum-input"> <input disabled :value="item.proportion" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> <view class="situation_item" style="height: 35px;"> <view class="stratum"> <view>地层含水%</view> <view class="stratum-input"> <input disabled :value="item.water" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> <view class="situation_item"> <view style="padding: 7px"> <view>颗分区间</view> <view class="interval"> <view style="display: flex"> <view class="interval-item"> <view class="interval-item-num"> >10 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size1" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="interval-item"> <view class="interval-item-num"> 10-2 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size2" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="interval-item"> <view class="interval-item-num"> 2-0.5 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size3" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="interval-item"> <view class="interval-item-num"> 0.5-0.25 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size4" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> <view class="interval"> <view style="display: flex"> <view class="interval-item"> <view class="interval-item-num"> 0.25-0.075 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size5" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="interval-item"> <view class="interval-item-num" style="white-space: nowrap"> 0.075-0.005 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size6" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="interval-item"> <view class="interval-item-num"> 小于0.005 </view> <view class="interval-item-input"> <input disabled :value="item.particleSize.size7" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> </view> </view> </view> </view> <view class="clay"> <view style="color: #82D4FF;margin-left: 18rpx;padding-top: 18rpx">泥水设备百分比设定</view> <view style="color:#fff;margin-left: 28rpx;margin-top: 18rpx">黏土</view> <view class="clay_item"> <view class="stratum"> <view class="title">滚动筛</view> <view class="stratum-select"> <view> <uni-section> <uni-data-select :localdata="rollRange" :disabled="disabled" :value="gdsObject.label" style="width: 100%;"></uni-data-select> </uni-section> </view> <!-- <view class="number" style="width: 80px">--> <!-- <uni-easyinput--> <!-- type="number"--> <!-- placeholder="0"--> <!-- :styles="{--> <!-- backgroundColor: 'rgba(187, 200, 242, 0.1)',--> <!-- borderRadius: '4px'--> <!-- }"--> <!-- >--> <!-- <template #right>--> <!-- <view style="display:flex;flex-direction: column">--> <!-- <uni-icons type="top" size="14" color="#ff0000" style="height: 15px"></uni-icons>--> <!-- <uni-icons type="down" size="14" color="#ff0000" style="height: 15px"></uni-icons>--> <!-- </view>--> <!-- </template>--> <!-- </uni-easyinput>--> <!-- </view>--> <view style="margin-left: 10px"> <uni-number-box disabled :step="0.001" :value="gdsObject.value" @change="changeValue" /> </view> <view class="checkbox" style="margin-left: 10rpx;white-space: nowrap"> <uni-data-checkbox disabled multiple :localdata="hobby"></uni-data-checkbox> </view> </view> </view> </view> <view class="clay_item"> <view class="stratum"> <view class="title">振动筛</view> <view class="stratum-select"> <view> <uni-section> <uni-data-select :localdata="vibrationRange" :disabled="disabled" :value="zdsObject.label" style="width: 100%;"></uni-data-select> </uni-section> </view> <view style="margin-left: 18rpx"> <uni-number-box disabled :step="0.001" :value="zdsObject.value" @change="changeValue" /> </view> <view class="checkbox" style="margin-left: 10rpx;white-space: nowrap"> <uni-data-checkbox disabled multiple :localdata="hobby"></uni-data-checkbox> </view> </view> </view> </view> <view class="clay_item"> <view class="stratum" style="white-space: nowrap"> <view class="title">一级旋流器</view> <view class="stratum-select-one"> <view> <uni-section> <uni-data-select :localdata="oneRange" :disabled="disabled" :value="xlq1Object.label" style="width: 100%;"></uni-data-select> </uni-section> </view> <view style="margin-left: 18rpx"> <uni-number-box disabled :step="0.001" :value="xlq1Object.value" @change="changeValue" /> </view> <view style="margin-left: 10rpx;white-space: nowrap"> <uni-data-checkbox disabled multiple :localdata="hobby"></uni-data-checkbox> </view> </view> </view> </view> <view class="clay_item"> <view class="stratum" style="white-space: nowrap"> <view class="title">二级旋流器</view> <view class="stratum-select-two"> <view> <uni-section> <uni-data-select :localdata="twoRange" :disabled="disabled" :value="xlq2Object.label" style="width: 100%;"></uni-data-select> </uni-section> </view> <view style="margin-left: 18rpx"> <uni-number-box disabled :step="0.001" :value="xlq2Object.value" @change="changeValue" /> </view> <view style="margin-left: 10rpx;white-space: nowrap"> <uni-data-checkbox disabled multiple :localdata="hobby"></uni-data-checkbox> </view> </view> </view> </view> <view class="clay_item"> <view class="stratum"> <view class="title">脱水筛</view> <view class="stratum-select"> <view> <uni-section> <uni-data-select :localdata="dehydrationRange" :disabled="disabled" :value="tssObject.label" style="width: 100%;"></uni-data-select> </uni-section> </view> <view style="margin-left: 18rpx"> <uni-number-box disabled :step="0.001" :value="tssObject.value" @change="changeValue" /> </view> <view style="margin-left: 10rpx;white-space: nowrap"> <uni-data-checkbox disabled multiple :localdata="hobby"></uni-data-checkbox> </view> </view> </view> </view> <view class="clay_item" style="height: 198rpx;"> <view class="sieve"> <view class="title">滚动筛</view> <view class="sieve-select"> <view>滚动筛喷淋水容量:</view> <view> <uni-number-box disabled :step="0.001" :value="gdsDzsplsrl" @change="changeValue" /> </view> </view> </view> </view> <view class="clay_item" style="height: 198rpx;"> <view class="sieve"> <view class="title">脱水筛</view> <view class="sieve-select"> <view>筛上物密度:</view> <view> <uni-number-box disabled :step="0.001" :value="ttsSswmd" @change="changeValue" /> </view> </view> </view> </view> <view class="clay_item" style="height: 258rpx;"> <view class="sieve"> <view class="title">预筛</view> <view class="sieve-select" style="margin-bottom: 18rpx"> <view>筛上物密度:</view> <view> <uni-number-box disabled :step="0.001" :value="ysSswmd" @change="changeValue" /> </view> </view> <view class="sieve-select"> <view>振动筛喷淋水容量:</view> <view> <uni-number-box disabled :step="0.001" :value="ysZdsplsrl" @change="changeValue" /> </view> </view> </view> </view> <view class="clay_item" style="height: 258rpx;"> <view class="sieve"> <view class="title">旋流器</view> <view class="sieve-select" style="margin-bottom: 18rpx"> <view>一级底流物密度:</view> <view> <uni-number-box disabled :step="0.001" :value="xlq1Dlwmd" @change="changeValue" /> </view> </view> <view class="sieve-select"> <view>二级底流物密度:</view> <view> <uni-number-box disabled :step="0.001" :value="xlq2Dlwm" @change="changeValue" /> </view> </view> </view> </view> </view> </view> </view> <view style="color: #fff;margin:38rpx 0 38rpx 18rpx;">输出</view> <view class="history_item"> <view style="padding:18rpx"> <view class="mudRes"> <view style="color: #82D4FF;margin-left: 18rpx;padding-top: 18rpx">计算处理百分比</view> <view class="mudRes_item" v-for="(item,index) in 5" :key="index"> <view class="title">黏土</view> <view class="content"> <view style="display: flex"> <view class="content_item"> <view class="content-item-title"> 滚动筛% </view> <view class="content-item-input"> <input disabled :value="rollingScreen" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 振动筛% </view> <view class="content-item-input"> <input disabled :value="vibratingScreen" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 一级旋流器% </view> <view class="content-item-input"> <input disabled :value="xlq1" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> <view class="content_item"> <view class="content-item-title" style="width: 198rpx"> 二级旋流器% </view> <view class="content-item-input"> <input disabled :value="xlq2" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> <view class="mudRes_item" v-for="(item,index) in 2" :key="index"> <view class="title">滚动筛筛下物</view> <view class="content"> <view style="display: flex"> <view class="content_item"> <view class="content-item-title"> 流量m³/R </view> <view class="content-item-input"> <input disabled :value="flow" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 比重g/m³ </view> <view class="content-item-input"> <input disabled :value="weight" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 固相T/R </view> <view class="content-item-input"> <input disabled :value="solid" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> <view class="content_item"> <view class="content-item-title" style="width: 198rpx"> 液相m³/R </view> <view class="content-item-input"> <input disabled :value="liquid" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> <view class="title" style="color: #82D4FF">泥浆池数据</view> <view class="mudRes_item"> <view class="content"> <view style="display: flex"> <view class="content_item"> <view class="content-item-title"> 调整池m³ </view> <view class="content-item-input"> <input disabled :value="adjustmentPool" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 废浆池m³ </view> <view class="content-item-input"> <input disabled :value="wasteMudPool" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 清水池m³ </view> <view class="content-item-input"> <input disabled :value="cleanWaterPool" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> <view style="display: flex"> <view class="content_item"> <view class="content-item-title" style="width: 198rpx"> 新浆池m³ </view> <view class="content-item-input"> <input disabled :value="newMudPool" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title" style="width: 198rpx"> 工业水池m³ </view> <view class="content-item-input"> <input disabled :value="industrialWaterPool" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title" style="width: 198rpx"> 集土坑m³ </view> <view class="content-item-input"> <input disabled :value="soilCollectionPit" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> </view> <view class="title" style="color: #82D4FF">干化配置数据</view> <view class="mudRes_item"> <view v-for="(item,index) in 5" :key="index"> <view class="title">黏土</view> <view class="content"> <view style="display: flex"> <view class="content_item"> <view class="content-item-title"> 弃土量m³/R </view> <view class="content-item-input"> <input disabled :value="qituliang" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 弃浆量m³/R </view> <view class="content-item-input"> <input disabled :value="qijiangliang" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title"> 需水量m³/R </view> <view class="content-item-input"> <input disabled :value="xushuiliang" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> <view style="display: flex"> <view class="content_item"> <view class="content-item-title" style="width: 210rpx"> 干化配置推荐 </view> <view class="content-item-input"> <input disabled :value="ganhuaConfiguration" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> <view class="content_item"> <view class="content-item-title" style="width: 210rpx"> 弃浆配置推荐 </view> <view class="content-item-input"> <input disabled :value="qijiangConfiguration" style="width: 100%; height: 100%; background: transparent; border: none; outline: none; color: inherit; text-align: inherit;" /> </view> </view> </view> </view> </view> </view> </view> </view> </view> </view> </view> </Layout> </template> <script setup> import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue' import Layout from '@/layout/index.vue' import { error } from 'uview-plus'; import { myDetailLogin } from '../../apis/myDetail'; const detail = async () => { error.value = ''; loading.value = true; } const rollRange = [{ value: 0, text: "10mm" }, { value: 1, text: "7mm" }, { value: 2, text: "5mm" }, ] const vibrationRange = [{ value: 0, text: "6mm" }, { value: 1, text: "3mm" }, { value: 2, text: "1.5mm" }, ] const oneRange = [{ value: 0, text: "500" }, { value: 1, text: "375" }, { value: 2, text: "350" }, { value: 3, text: "250" }, ] const twoRange = [{ value: 0, text: "150" }, { value: 1, text: "125" }, { value: 2, text: "100" }, ] const dehydrationRange = [{ value: 0, text: "0.6mm" }, { value: 1, text: "0.35mm" }, ] const characterOne = [{ value: 0, text: "黏土" }, { value: 1, text: "粉土" }, { value: 2, text: "砂" }, { value: 3, text: "圆砾" }, { value: 4, text: "卵石" }, { value: 5, text: "岩层" }, { value: 6, text: "淤泥" }, ] const characterTwo = [{ value: 0, text: "流塑" }, { value: 1, text: "软塑" }, { value: 2, text: "可塑" }, { value: 3, text: "硬塑" }, ] const hobby = [{ text: '已选中项', value: 0 }] const stratumList = ref([{ particleSize: { size1: '0', size2: '0', size3: '0', size4: '0', size5: '0', size6: '70', size7: '30' } }]); const switchTab = (tab) => { activeTab.value = tab } const open = () => { uni.navigateTo({ url: '/pages/index/index' }) } //添加地层 const addStratum = () => { //添加一个新的地层对象到数组 stratumList.value.push({}); // 滚动到底部 nextTick(() => { const container = uni.createSelectorQuery().select('.situation'); container.boundingClientRect(data => { uni.pageScrollTo({ scrollTop: data.height, duration: 300 }); }).exec(); }); } //编辑数据 const editData = () => { //跳转到计算页 uni.navigateTo({ url: '/pages/calculate/index' }); } watch(value, (newVal) => { if (newVal === 0) { // 黏土 const currentStratum = stratumList.value[stratumList.value.length - 1]; if (currentStratum) { currentStratum.particleSize = { size1: '0', size2: '0', size3: '0', size4: '0', size5: '0', size6: '70', // 0.075-0.005 size7: '30' // <0.005 }; } } if (newVal === 1) { // 粉土 const currentStratum = stratumList.value[stratumList.value.length - 1]; if (currentStratum) { currentStratum.particleSize = { size1: '0', size2: '0', size3: '0', size4: '0', size5: '45', size6: '45', size7: '10' }; } } if (newVal === 2) { // 砂 const currentStratum = stratumList.value[stratumList.value.length - 1]; if (currentStratum) { currentStratum.particleSize = { size1: '0', size2: '0', size3: '5', size4: '25', size5: '25', size6: '40', size7: '5' }; } } if (newVal === 3) { // 圆砾 const currentStratum = stratumList.value[stratumList.value.length - 1]; if (currentStratum) { currentStratum.particleSize = { size1: '40', size2: '15', size3: '10', size4: '10', size5: '5', size6: '15', size7: '5' }; } } if (newVal === 4 || newVal === 5) { //卵石 岩层 const currentStratum = stratumList.value[stratumList.value.length - 1]; if (currentStratum) { currentStratum.particleSize = { size1: '0', size2: '0', size3: '0', size4: '0', size5: '0', size6: '0', size7: '0' }; } } }); onMounted(() => { }) // 组件卸载时执行 onUnmounted(() => { }) </script> 这一段代码的目的是,在用户点击某个项目的时候,通过变量id,进入到此界面,此界面为数据详情,会通过匹配id,把其他所有的数据,渲染到其对应的位置上,id是一个变量 import { request } from '@/utils' export function myDetailLogin(id){ return request({ url: `/api/projbase/getById/${id}` , method:'GET' }) }这里是接口代码
06-23
<template> <view class="work-container"> <!-- 轮播图 --> <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content"> <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper"> <swiper-item v-for="(item, index) in data" :key="index"> <view class="swiper-item" @click="clickBannerItem(item)"> <image :src="item.image" mode="aspectFill" :draggable="false" /> </view> </swiper-item> </swiper> </uni-swiper-dot> <!-- 宫格组件 --> <uni-section title="系统管理" type="line"></uni-section> </view> </template> <script> export default { data() { return { current: 0, swiperDotIndex: 0, data: [{ image: '/static/images/banner/banner01.jpg' }, { image: '/static/images/banner/banner02.jpg' }, { image: '/static/images/banner/banner03.jpg' } ] } }, methods: { clickBannerItem(item) { console.info(item) }, changeSwiper(e) { this.current = e.detail.current }, changeGrid(e) { // this.$modal.showToast('模块建设中~') }, handleShop(){ this.$tab.navigateTo('/pages/work/shop/index') this.$modal.showToast('点餐模块建设中~') } } } </script> <style lang="scss" scoped> /* #ifndef APP-NVUE */ page { display: flex; flex-direction: column; box-sizing: border-box; background-color: #fff; min-height: 100%; height: auto; } view { font-size: 14px; line-height: inherit; } /* #endif */ .text { text-align: center; font-size: 26rpx; margin-top: 10rpx; } .grid-item-box { flex: 1; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; align-items: center; justify-content: center; padding: 15px 0; } .uni-margin-wrap { width: 690rpx; width: 100%; ; } .swiper { height: 300rpx; } .swiper-box { height: 150px; } .swiper-item { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; justify-content: center; align-items: center; color: #fff; height: 300rpx; line-height: 300rpx; } @media screen and (min-width: 500px) { .uni-swiper-dot-box { width: 400px; /* #ifndef APP-NVUE */ margin: 0 auto; /* #endif */ margin-top: 8px; } .image { width: 100%; } } </style> 编写一个点餐页面,要求 : 按行的形式显示菜品 ,要显示菜品图片 ,剩余数量,点击添加按钮
最新发布
07-18
<!DOCTYPE html> <!--suppress ALL --> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>安全登录系统</title> <style> :root { /* 合并后的统一变量 */ --white: #e9e9e9; --gray: #333; --blue: #0367a6; --lightblue: #008997; --button-radius: 0.7rem; --max-width: 758px; --max-height: 420px; font-size: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; } body { align-items: center; background: url("https://res.cloudinary.com/dbhnlktrv/image/upload/v1599997626/background_oeuhe7.jpg"); background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; display: grid; height: 100vh; place-items: center; margin: 0; } .form__title { font-weight: 300; margin: 0; margin-bottom: 1.25rem; } .link { color: var(--gray); font-size: 0.9rem; margin: 1.5rem 0; text-decoration: none; } .container { background-color: var(--white); border-radius: var(--button-radius); box-shadow: 0 0.9rem 1.7rem rgba(0, 0, 0, 0.25), 0 0.7rem 0.7rem rgba(0, 0, 0, 0.22); height: var(--max-height); max-width: var(--max-width); overflow: hidden; position: relative; width: 100%; } .container__form { height: 100%; position: absolute; top: 0; transition: all 0.6s ease-in-out; } .container--signin { left: 0; width: 50%; z-index: 2; } .container.right-panel-active .container--signin { transform: translateX(100%); } .container--signup { left: 0; opacity: 0; width: 50%; z-index: 1; } .container.right-panel-active .container--signup { animation: show 0.6s; opacity: 1; transform: translateX(100%); z-index: 5; } .container__overlay { height: 100%; left: 50%; overflow: hidden; position: absolute; top: 0; transition: transform 0.6s ease-in-out; width: 50%; z-index: 100; } .container.right-panel-active .container__overlay { transform: translateX(-100%); } .overlay { background: url("https://cdn.pixabay.com/photo/2018/08/14/13/23/ocean-3605547_1280.jpg"); background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; height: 100%; left: -100%; position: relative; transform: translateX(0); transition: transform 0.6s ease-in-out; width: 200%; } .container.right-panel-active .overlay { transform: translateX(50%); } .overlay__panel { align-items: center; display: flex; flex-direction: column; height: 100%; justify-content: center; position: absolute; text-align: center; top: 0; transform: translateX(0); transition: transform 0.6s ease-in-out; width: 50%; } .overlay--left { transform: translateX(-20%); } .container.right-panel-active .overlay--left { transform: translateX(0); } .overlay--right { right: 0; transform: translateX(0); } .container.right-panel-active .overlay--right { transform: translateX(20%); } .btn { background-color: var(--blue); background-image: linear-gradient(90deg, var(--blue) 0%, var(--lightblue) 74%); border-radius: 20px; border: 1px solid var(--blue); color: var(--white); cursor: pointer; font-size: 0.8rem; font-weight: bold; letter-spacing: 0.1rem; padding: 0.9rem 4rem; text-transform: uppercase; transition: transform 80ms ease-in; } .form > .btn { margin-top: 1.5rem; } .btn:active { transform: scale(0.95); } .btn:focus { outline: none; } .form { background-color: var(--white); display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 0 3rem; height: 100%; text-align: center; } .input { background-color: #fff; border: none; padding: 0.9rem 0.9rem; margin: 0.5rem 0; width: 100%; box-sizing: border-box; } @keyframes show { 0%, 49.99% { opacity: 0; z-index: 1; } 50%, 100% { opacity: 1; z-index: 5; } } /* 新增功能样式 */ .loader { border: 4px solid rgba(0, 0, 0, 0.1); border-top: 4px solid #0367a6; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; display: none; margin: 10px auto; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .error-message { color: #ff3860; font-size: 0.85rem; margin-top: 0.5rem; height: 20px; display: flex; align-items: center; justify-content: center; } .hidden { display: none; } .password-container { position: relative; width: 100%; } .toggle-password { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--gray); cursor: pointer; font-size: 0.8rem; } .success-message { color: #23d160; font-size: 0.85rem; margin-top: 0.5rem; display: none; } </style> </head> <body> <!-- 登录页面容器 --> <div id="loginPage" class="container right-panel-active"> <!-- 注册表单 --> <div class="container__form container--signup"> <form class="form" id="signupForm"> <h2 class="form__title">注册账号</h2> <input type="text" placeholder="用户名" class="input" required id="signupUsername"/> <input type="email" placeholder="邮箱" class="input" required id="signupEmail"/> <div class="password-container"> <input type="password" placeholder="密码" class="input" required id="signupPassword"/> <button type="button" class="toggle-password">👁️</button> </div> <div class="error-message" id="signupError"></div> <div class="success-message" id="signupSuccess"></div> <button class="btn" type="submit">注册</button> </form> </div> <!-- 登录表单 --> <div class="container__form container--signin"> <form class="form" id="loginForm"> <h2 class="form__title">用户登录</h2> <input type="email" placeholder="邮箱" class="input" required id="loginEmail"/> <div class="password-container"> <input type="password" placeholder="密码" class="input" required id="loginPassword"/> <button type="button" class="toggle-password">👁️</button> </div> <div class="loader" id="loginLoader"></div> <div class="error-message" id="loginError"></div> <button class="btn" type="submit">登录</button> </form> </div> <!-- 覆盖层 --> <div class="container__overlay"> <div class="overlay"> <div class="overlay__panel overlay--left"> <button class="btn" id="signInBtn">去登录</button> </div> <div class="overlay__panel overlay--right"> <button class="btn" id="signUpBtn">去注册</button> </div> </div> </div> </div> <!-- 仪表盘页面 (登录成功后显示) --> <div id="dashboardPage" class="hidden"> <div class="container" style="background-color: #ffffff; padding: 15rem; max-width: 1000px;"> <h2>欢迎, <span id="userDisplayName"></span>!</h2> <p>您已成功登录!这是您的个人控制面板。</p> <!-- 文本输入区域 --> <div style="margin-top: 2rem;"> <h3>内容编辑区</h3> <textarea id="userContent" rows="6" style="width: 100%; padding: 10px; font-family: inherit; font-size: 1rem;"></textarea> <button id="saveContentBtn" class="btn" style="margin-top: 1rem; padding: 0.7rem 2rem;">保存内容</button> <div class="success-message" id="saveSuccess" style="text-align: left; margin-top: 0.5rem;"></div> </div> <div style="margin-top: 2rem;"> <p>电子邮箱: <span id="userEmailDisplay"></span></p> <p>注册时间: <span id="registrationDate"></span></p> <button id="logoutBtn" class="btn" style="margin-top: 2rem;">退出登录</button> </div> </div> </div> <script> // ======== 页面元素 ======== const signInBtn = document.getElementById("signInBtn"); const signUpBtn = document.getElementById("signUpBtn"); const container = document.querySelector(".container"); const loginForm = document.getElementById("loginForm"); const signupForm = document.getElementById("signupForm"); const loginLoader = document.getElementById("loginLoader"); const loginError = document.getElementById("loginError"); const signupError = document.getElementById("signupError"); const signupSuccess = document.getElementById("signupSuccess"); const loginPage = document.getElementById("loginPage"); const dashboardPage = document.getElementById("dashboardPage"); const logoutBtn = document.getElementById("logoutBtn"); const userDisplayName = document.getElementById("userDisplayName"); const userEmailDisplay = document.getElementById("userEmailDisplay"); const registrationDate = document.getElementById("registrationDate"); const togglePasswordBtns = document.querySelectorAll(".toggle-password"); // ======== 密码可见性切换 ======== togglePasswordBtns.forEach(btn => { btn.addEventListener("click", function () { const input = this.previousElementSibling; const type = input.getAttribute("type") === "password" ? "text" : "password"; input.setAttribute("type", type); this.textContent = type === "password" ? "👁️" : "🔒"; }); }); // ======== 面板切换功能 ======== signInBtn.addEventListener("click", () => { container.classList.remove("right-panel-active"); clearMessages(); }); signUpBtn.addEventListener("click", () => { container.classList.add("right-panel-active"); clearMessages(); }); // ======== 注册功能 ======== signupForm.addEventListener("submit", function (e) { e.preventDefault(); const username = document.getElementById("signupUsername").value.trim(); const email = document.getElementById("signupEmail").value.trim(); const password = document.getElementById("signupPassword").value; // 验证用户名(至少3个字符) if (username.length < 3) { showSignupError("用户名至少需要3个字符"); return; } // 验证邮箱格式 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(email)) { showSignupError("请输入有效的电子邮箱"); return; } // 验证密码强度(至少6个字符) if (password.length < 6) { showSignupError("密码长度至少为6个字符"); return; } // 检查用户是否已注册(伪代码) if (localStorage.getItem(email)) { showSignupError("该邮箱已注册"); return; } // 保存注册信息 const userData = { username, email, password, // 实际应用中应存储哈希值而非明文 registrationDate: new Date().toLocaleDateString() }; localStorage.setItem(email, JSON.stringify(userData)); // 注册成功 signupSuccess.textContent = "注册成功!"; signupSuccess.style.display = "block"; signupError.style.display = "none"; // 3秒后切换到登录面板 setTimeout(() => { container.classList.remove("right-panel-active"); signupForm.reset(); signupSuccess.style.display = "none"; }, 3000); }); // ======== 登录功能 ======== loginForm.addEventListener("submit", function (e) { e.preventDefault(); const email = document.getElementById("loginEmail").value; const password = document.getElementById("loginPassword").value; // 显示加载状态 loginLoader.style.display = 'block'; loginError.style.display = 'none'; // 模拟登录请求延迟 setTimeout(() => { const authResult = authenticateUser(email, password); if (authResult.success) { // 保存登录状态 localStorage.setItem("isLoggedIn", "true"); localStorage.setItem("currentUser", JSON.stringify(authResult.userData)); // 更新仪表盘信息 updateDashboard(authResult.userData); // 切换到仪表盘 loginPage.classList.add("hidden"); dashboardPage.classList.remove("hidden"); } else { showLoginError(authResult.message); } loginLoader.style.display = 'none'; }, 1500); }); // ======== 退出功能 ======== logoutBtn.addEventListener("click", function () { // 清除登录状态 localStorage.removeItem("isLoggedIn"); localStorage.removeItem("currentUser"); // 返回登录页面 dashboardPage.classList.add("hidden"); loginPage.classList.remove("hidden"); // 重置表单 loginForm.reset(); clearMessages(); }); // ======== 辅助函数 ======== function authenticateUser(email, password) { // 从本地存储获取用户数据 const userData = localStorage.getItem(email); if (!userData) { return { success: false, message: "邮箱未注册" }; } const user = JSON.parse(userData); // 实际应用中应使用密码哈希值比较 if (password !== user.password) { return { success: false, message: "邮箱或密码错误" }; } return { success: true, userData: user }; } function updateDashboard(userData) { userDisplayName.textContent = userData.username; userEmailDisplay.textContent = userData.email; registrationDate.textContent = userData.registrationDate; } function showLoginError(message) { loginError.textContent = message; loginError.style.display = 'block'; } function showSignupError(message) { signupError.textContent = message; signupError.style.display = 'block'; signupSuccess.style.display = "none"; } function clearMessages() { loginError.style.display = 'none'; signupError.style.display = 'none'; signupSuccess.style.display = 'none'; } // 页面加载时检查登录状态 window.addEventListener('DOMContentLoaded', () => { const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true'; const currentUser = localStorage.getItem('currentUser'); if (isLoggedIn && currentUser) { updateDashboard(JSON.parse(currentUser)); loginPage.classList.add("hidden"); dashboardPage.classList.remove("hidden"); } }); </script> </body> </html> 登陆成功后加一个上下滑动翻页功能
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值