<view class="selectFood" v-for="(item,index) in selectFood" :key="item" v-if="this.selectFood.length>0"> <image :src="item.imgUrl" mode=""></image> <p>{{item.data}}</p> <view class="select-icon"> <image src="../../static/squareImg/delete.png" mode=""></image> </view> </view> 现在有个数组selectFood,数组中有很多对象,现在我如果要随机点击select-icon的图片,对应的那条数组中的数据就被删除,如何实现

时间: 2023-08-06 22:04:48 浏览: 127
要实现点击 `select-icon` 图片后删除对应的数组中的数据,你可以在点击事件中获取当前点击的索引,然后使用该索引从 `selectFood` 数组中删除对应的元素。以下是一个示例代码: ```javascript <template> <div> <div v-for="(item, index) in selectFood" :key="index" class="selectFood"> <img :src="item.imgUrl" mode=""> <p>{{ item.data }}</p> <div class="select-icon"> <img src="../../static/squareImg/delete.png" mode="" @click="deleteItem(index)"> </div> </div> </div> </template> <script> export default { data() { return { selectFood: [ { imgUrl: '...', data: '...' }, { imgUrl: '...', data: '...' }, // more items ] }; }, methods: { deleteItem(index) { this.selectFood.splice(index, 1); } } }; </script> <style> /* CSS styles for selectFood and select-icon */ </style> ``` 在上述代码中,我们使用 `v-for` 指令遍历 `selectFood` 数组,并为每个元素渲染一个 `selectFood` div。在 `select-icon` 图片上添加了点击事件 `@click`,并传递了当前项的索引 `index` 给 `deleteItem()` 方法。在 `deleteItem()` 方法中,我们使用 `splice()` 方法从 `selectFood` 数组中删除了对应索引位置的元素。这样就能实现点击图片后删除对应的数组数据。
阅读全文

相关推荐

<template> <view class="container"> <view class="filter-box"> <view class="date-picker">开始日期:{{ startDate || '请选择' }}</view> <view class="date-picker">结束日期:{{ endDate || '请选择' }}</view> <button @tap="filterData" class="filter-btn">筛选</button> </view> <view class="progress-card"> <text class="title">个人考核进度</text> <text class="progress-text">{{ progress }}%(当前阶段:{{ currentStage }})</text> </view> <view class="tabs"> <text :class="['tab-item', activeTab === 0 ? 'active' : '']" @tap="switchTab(0)">订单记录</text> <text :class="['tab-item', activeTab === 1 ? 'active' : '']" @tap="switchTab(1)">消费记录</text> </view> <scroll-view scroll-y class="list-container" @scrolltolower="loadMore"> <view v-if="activeTab === 0" class="list"> <view v-for="(item, index) in filteredOrders" :key="index" class="list-item"> <text class="order-no">订单号:{{ item.orderNo }}</text> <text class="order-date">{{ item.date }}</text> <text class="order-amount">金额:¥{{ item.amount }}</text> </view> <view v-if="!filteredOrders.length" class="empty-tip">暂无订单记录</view> </view> <view v-if="activeTab === 1" class="list"> <view v-for="(item, index) in filteredConsumptions" :key="index" class="list-item"> <text class="consume-type">{{ item.type }}</text> <text class="consume-date">{{ item.date }}</text> <text class="consume-amount">¥{{ item.amount }}</text> </view> <view v-if="!filteredConsumptions.length" class="empty-tip">暂无消费记录</view> </view> <view v-if="loading" class="loading">加载中...</view> </scroll-view> </view> </template>我这里已经模拟数据了,为什么订单记录,消费记录还显示暂无数据

根据上述描述调整这部分代码<template> <view class="container"> <view class="section"> <view class="section-title">集装器信息</view> <view class="input-group"> <input type="text" v-model="containerCode" placeholder="集装器箱板号" @confirm="confirmContainer" /> <button @click="confirmContainer" type="default" size="mini">确认</button> <button @click="scanContainerCode" type="primary">扫描集装器</button> </view> <view class="pallet-list" v-if="containerCode"> <view class="list-title">已确认集装器</view> <view class="pallet-item"> <text>{{containerCode}}</text> <text class="delete" @click="clearContainer">删除</text> </view> </view> </view> <view class="section"> <view class="section-title">托盘信息</view> <view class="input-group"> <input type="text" v-model="palletCode" placeholder="托盘号" @confirm="addPallet" /> <button @click="addPallet" type="default" size="mini">确认</button> <button @click="scanPalletCode" type="primary">扫描托盘</button> </view> <view class="pallet-list" v-if="palletList.length > 0"> <view class="list-title">已关联托盘</view> <view v-for="(pallet, index) in palletList" :key="index" class="pallet-item"> <text>{{pallet.code}}</text> <text class="delete" @click="removePallet(index)">删除</text> </view> </view> </view> </view> <view class="index"> <sp-html2pdf-render domId="render-dom" ref="renderRef" pdfFileName="这是一个pdf文件" :isPagingEnabled="true" @beforeSavePDF="beforeSavePDF" @successSavePDF="successSavePDF" @renderOver="renderOver" ></sp-html2pdf-render> <view class="render-main"> <view id="render-dom" class="render-content"> <view class="photo-section">

<template> <Layout :have-tab-bar="false" icon=""> 我的项目 <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> <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> <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> <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 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' }) }这里是接口代码

要在 UniApp 中实现多个元素的锚点,结合 id 属性和 scroll-into-view 来实现锚点跳转,同时根据滚动位置来标记当前锚点。<u-col span="3"> <scroll-view scroll-y="true" class="sh_aside"> <view class="aside-item flex-fsfs" v-for="(item,i) in categories" :key="i" @tap="selectCategory(item)"> <text :class="['nomal-line',item.code==cateVal? 'active-line':'']"></text> <text :class="['nomal-desc',item.code==cateVal? 'active-desc':'']">{{item.name}}</text> </view> <view class="empty" style="padding-top: 20vh;" v-if="categories.length == 0"> 暂无分类 </view> </scroll-view> </u-col> <u-col span="9" > <view class="sh_main"> <view class="drop-box"> <u-dropdown> <u-dropdown-item active-color="#3296FA" inactive-color="#666666" height="500" :options="nutrients" v-model="nutVal" :title="crtNutrient.label" @change="dropdownChange"></u-dropdown-item> </u-dropdown> </view> <scroll-view scroll-y="true" class="sh_artcle" :scroll-into-view="crtView" > <view class="part" v-for="item,index in ingredientList" :key="index" :id="item.customId"> <view class="part-title"> {{item.name}} </view> <view class="flex-fsc part-list" v-for="sc,i in item.list" :key="i"> <image src="/https/wenku.csdn.net/static/images/manbing/recipes_sc_mrbj.png" mode="aspectFill" style="width: 83rpx;height: 83rpx;"></image> <view class=""> <view class=""> {{sc.name}} </view> <view class="part-text"> 营养元素 </view> </view> </view> <view class="empty" v-if="item.list.length == 0"> 暂无数据 </view> </view> <view class="empty" style="padding-top: 20vh;" v-if="ingredientList.length == 0"> 暂无数据 </view> </scroll-view> </view> </u-col> </u-row>

小小记事本 <input v-model="inputValue" @keyup.enter="add" autofocus="autofocus" autocomplete="off" placeholder="请输入任务" class="new-todo"></input>
{{ index+1 }}. <label>{{ item }}</label> <button class="destroy" @click="remove(index)"></button>
{{ list.length }} items left <button v-show="list.length!==0" class="clear-completed" @click="clear"> Clear </button> <input type="text" v-model="inputValue" /> <button @click="add">添加</button> {{ item }} <button @click="remove(index)">删除</button>
实现记事本的增,添,查改

最新推荐

recommend-type

GIS安装综合项目施工专项方案.doc

GIS安装综合项目施工专项方案.doc
recommend-type

CAM-BACK.7z

CAM_BACK.7z
recommend-type

Web网站的设计专项方案管理与维护.doc

Web网站的设计专项方案管理与维护.doc
recommend-type

Revman软件操作PPT学习课件.ppt

Revman软件操作PPT学习课件.ppt
recommend-type

ASP.NET新闻管理系统:用户管理与内容发布功能

知识点: 1. ASP.NET 概念:ASP.NET 是一个开源、服务器端 Web 应用程序框架,用于构建现代 Web 应用程序。它是 .NET Framework 的一部分,允许开发者使用 .NET 语言(例如 C# 或 VB.NET)来编写网页和 Web 服务。 2. 新闻发布系统功能:新闻发布系统通常具备用户管理、新闻分级、编辑器处理、发布、修改、删除等功能。用户管理指的是系统对不同角色的用户进行权限分配,比如管理员和普通编辑。新闻分级可能是为了根据新闻的重要程度对它们进行分类。编辑器处理涉及到文章内容的编辑和排版,常见的编辑器有CKEditor、TinyMCE等。而发布、修改、删除功能则是新闻发布系统的基本操作。 3. .NET 2.0:.NET 2.0是微软发布的一个较早版本的.NET框架,它是构建应用程序的基础,提供了大量的库和类。它在当时被广泛使用,并支持了大量企业级应用的构建。 4. 文件结构分析:根据提供的压缩包子文件的文件名称列表,我们可以看到以下信息: - www.knowsky.com.txt:这可能是一个文本文件,包含着Knowsky网站的一些信息或者某个页面的具体内容。Knowsky可能是一个技术社区或者文档分享平台,用户可以通过这个链接获取更多关于动态网站制作的资料。 - 源码下载.txt:这同样是一个文本文件,顾名思义,它可能包含了一个新闻系统示例的源代码下载链接或指引。用户可以根据指引下载到该新闻发布系统的源代码,进行学习或进一步的定制开发。 - 动态网站制作指南.url:这个文件是一个URL快捷方式,它指向一个网页资源,该资源可能包含关于动态网站制作的教程、指南或者最佳实践,这对于理解动态网站的工作原理和开发技术将非常有帮助。 - LixyNews:LixyNews很可能是一个项目文件夹,里面包含新闻发布系统的源代码文件。通常,ASP.NET项目会包含多个文件,如.aspx文件(用户界面)、.cs文件(C#代码后台逻辑)、.aspx.cs文件(页面的代码后台)等。这个文件夹中应该还包含Web.config配置文件,它用于配置整个项目的运行参数和环境。 5. 编程语言和工具:ASP.NET主要是使用C#或者VB.NET这两种语言开发的。在该新闻发布系统中,开发者可以使用Visual Studio或其他兼容的IDE来编写、调试和部署网站。 6. 新闻分级和用户管理:新闻分级通常涉及到不同的栏目分类,分类可以是按照新闻类型(如国际、国内、娱乐等),也可以是按照新闻热度或重要性(如头条、焦点等)进行分级。用户管理则是指系统需具备不同的用户身份验证和权限控制机制,保证只有授权用户可以进行新闻的发布、修改和删除等操作。 7. 编辑器处理:一个新闻发布系统的核心组件之一是所使用的Web编辑器。这个编辑器可以是内置的简单文本框,也可以是富文本编辑器(WYSIWYG,即所见即所得编辑器),后者能够提供类似于Word的编辑体验,并能输出格式化后的HTML代码。CKEditor和TinyMCE是常用的开源Web编辑器,它们支持插入图片、视频、表格等多种媒体,并能对文本进行复杂的格式化操作。 8. 发布、修改和删除功能:这是新闻发布系统的基本操作功能。发布功能允许用户将编辑好的新闻内容上线;修改功能可以对已发布的新闻内容进行更新;删除功能则用于移除不再需要的新闻文章。这些操作通常需要后台管理界面来支持,并且系统会在数据库中记录相关操作的记录,以便管理历史版本和审计日志。 以上知识点覆盖了从ASP.NET基础、新闻发布系统的具体功能实现到系统开发过程中的细节处理等多个方面。开发者在构建类似系统时,需要深入了解这些知识点,才能设计和实现一个功能完备、易用、安全的新闻发布系统。
recommend-type

【实战派量化投资秘籍】:Pair Trading策略全方位解析

# 摘要 量化投资中的Pair Trading策略是一种依赖统计套利和市场效率假说的交易方法,其核心在于选择相关性高的资产作为交易对并应用协整理论进行市场中立投资。本文首先概述了Pair Trading策略的理论基础,随后详细探讨了策略的实操技巧,包括数据预处理、模型建立和交易信号生成。接着,文章重点介绍了策略的编程实现,提供了环境搭建
recommend-type

fpga中保持时间建立时间时序约束

<think>我们讨论的是FPGA中的建立时间(Setup Time)和保持时间(Hold Time)时序约束问题。建立时间是指在时钟有效边沿到来之前,数据必须保持稳定的最小时间。保持时间是指在时钟有效边沿到来之后,数据必须保持稳定的最小时间。时序约束就是确保设计满足这些时间要求。 在FPGA设计中,我们通过时序约束(如时钟约束、输入输出延迟约束等)来告知工具设计的时序要求,工具会根据这些约束进行优化和验证。 以下是关于建立时间和保持时间时序约束的详细说明: ### 1. 建立时间和保持时间的基本概念 - **建立时间(Setup Time)**:时钟边沿到达前,数据必须稳定的时间。 -
recommend-type

Notepad2: 高效替代XP系统记事本的多功能文本编辑器

### 知识点详解 #### 标题解析 - **Vista记事本(Notepad2)**: Vista记事本指的是一款名为Notepad2的文本编辑器,它不是Windows Vista系统自带的记事本,而是一个第三方软件,具备高级编辑功能,使得用户在编辑文本文件时拥有更多便利。 - **可以替换xp记事本Notepad**: 这里指的是Notepad2拥有替换Windows XP系统自带记事本(Notepad)的能力,意味着用户可以安装Notepad2来获取更强大的文本处理功能。 #### 描述解析 - **自定义语法高亮**: Notepad2支持自定义语法高亮显示,可以对编程语言如HTML, XML, CSS, JavaScript等进行关键字着色,从而提高代码的可读性。 - **支持多种编码互换**: 用户可以在不同的字符编码格式(如ANSI, Unicode, UTF-8)之间进行转换,确保文本文件在不同编码环境下均能正确显示和编辑。 - **无限书签功能**: Notepad2支持设置多个书签,用户可以根据需要对重要代码行或者文本行进行标记,方便快捷地进行定位。 - **空格和制表符的显示与转换**: 该编辑器可以将空格和制表符以不同颜色高亮显示,便于区分,并且可以将它们互相转换。 - **文本块操作**: 支持使用ALT键结合鼠标操作,进行文本的快速选择和编辑。 - **括号配对高亮显示**: 对于编程代码中的括号配对,Notepad2能够高亮显示,方便开发者查看代码结构。 - **自定义代码页和字符集**: 支持对代码页和字符集进行自定义,以提高对中文等多字节字符的支持。 - **标准正则表达式**: 提供了标准的正则表达式搜索和替换功能,增强了文本处理的灵活性。 - **半透明模式**: Notepad2支持半透明模式,这是一个具有视觉效果的功能,使得用户体验更加友好。 - **快速调整页面大小**: 用户可以快速放大或缩小编辑器窗口,而无需更改字体大小。 #### 替换系统记事本的方法 - **Windows XP/2000系统替换方法**: 首先关闭系统文件保护,然后删除系统文件夹中的notepad.exe,将Notepad2.exe重命名为notepad.exe,并将其复制到C:\Windows和C:\Windows\System32目录下,替换旧的记事本程序。 - **Windows 98系统替换方法**: 直接将重命名后的Notepad2.exe复制到C:\Windows和C:\Windows\System32目录下,替换旧的记事本程序。 #### 关闭系统文件保护的方法 - 通过修改Windows注册表中的"SFCDisable"键值,可以临时禁用Windows系统的文件保护功能。设置键值为"FFFFFF9D"则关闭文件保护,设置为"0"则重新启用。 #### 下载地址 - 提供了Notepad2的下载链接,用户可以通过该链接获取安装包。 #### 文件压缩包内文件名 - **Notepad2MOD1.1.0.8CN.exe**: 这是压缩包内所含的Notepad2编译版本,表明这是一个中文版的安装程序,版本号为1.1.0.8。 ### 总结 Notepad2是一款强大的文本编辑器,它继承了传统的记事本程序界面,同时引入了诸多增强功能,如语法高亮、编码格式转换、书签管理、文本操作快捷键、括号高亮匹配等。这使得它在处理代码、标记语言和其他文本文件时具备极大的优势。用户可以通过替换系统默认记事本的方式,将Notepad2融入到操作系统中,充分享受这些高级功能带来的便捷。同时,提供了关闭系统文件保护的方法,以便用户能够顺利完成替换工作。最后,给出了下载地址,方便用户获取软件安装包。
recommend-type

【mPower1203驱动故障全攻略】:排除新手疑难杂症,提升部署效率

# 1. mPower1203驱动概述与故障诊断基础 在当今信息技术飞速发展的时代,高效准确地诊断和解决驱动故障对于确保企业级IT系统的稳定运行至关重要。mPower1203驱动作为一个广泛应用于高性能计算和数据处理领域的驱动程序,它的稳定性和性能优化对于很多关键业务系统都是不可忽视的。本章节将为您提供一个mPower1203驱动的概述,并对故障诊断的
recommend-type

keil5打不开

<think>我们正在处理Keil 5无法打开的问题。根据引用资料,可能的原因和解决方案如下: 1. 工程路径过长:将工程移动到较短的路径下(如D:\Project)[^3]。 2. 需要安装C51支持包(如果涉及51单片机)[^2]。 3. 编译器配置问题:重新安装或添加ARM编译器[^4]。 4. 软件冲突:以管理员身份运行Keil,并确保安装路径正确。 下面详细说明解决方案:</think>### Keil 5无法打开的解决方法 根据引用资料,Keil 5无法打开通常有以下几种原因及解决方案: #### 1. **工程路径过长问题** [^3] 当工程文件路径嵌套过深时(