当前位置:网站首页>Edit, cancel, pull up menu
Edit, cancel, pull up menu
2022-04-23 05:26:00 【Courtesy.】
- introduce Apex Pull up menu component
Child components
/* Icon */
<import name="my-icon" src="apex-ui/components/icon/index"></import>
/* Pull up menu */
<import name="my-action-sheet" src="apex-ui/components/action-sheet/index"></import>
html
<div class="btn">
<!-- Multifunction button -->
<my-button
ontap="actionSheet('default')"
type="ghost"
inline="true"
icon="menu">
</my-button>
<my-action-sheet id="actionSheet"></my-action-sheet>
</div>
js
export default {
data() {
return {
timerActionSheet: null
}
},
actionSheet(theme){
if(this.timerActionSheet) clearTimeout(this.timerActionSheet)
this.$child('actionSheet').showSheet({
theme,
titleText: ' Automatic shutdown after three seconds ',
buttons: [
{
text: ' edit ',
},
{
text: ' Overhead ',
}
],
buttonClicked: (index,item)=>{
//index==0 On behalf of the editor
if(index==0){
const router = require('@system.router') // What does this sentence mean ???????
router.clear()
router.push({
uri: 'pages/add', // Click Edit to jump to the add page ( Pass jump... By specifying parameters )
params: {
title: this.memo.title,
content: this.memo.content,
index: this.memo.index,
label: this.memo.label,
}
})
}
// index==1 Stands for overhead
//this.$emit("function",param); Child components pass values to parent components
if (index == 1) {
this.$emit('topUp', {
index: this.index })
}
return true
}
Parent component
<!-- list -->
<div class="list">
<block for="searchList">
<memo memo="{
{$item}}" index="{
{$idx}}" @top-up="topUp"></memo>
// @top-up="topUp" The previous definition Do not use hump type
</block>
</div>
</div>
topUp(e){
let obj = {
}; // Define an object
this.memoList.forEach((item,index)=>{
// Yes memoList This array passes through index Subscript for for loop
if(index === e.detail.index){
// If the subscript corresponds to the selected , Then the top setting function takes effect , take item Add to obj In this array
item.is_top=true;
obj = item;
this.memoList.splice(index,1) //memoList The first parameter in this object is the first position
return;
}else{
item.is_top=false; // otherwise Overhead invalid
}
})
// Add data from the last item in the array Put it back
// this.memoList.push(obj);
// Add... To the first item of the array Overhead / Put forward
this.memoList.unshift(obj);
setMemoList(this.memoList);
}
Delete is written in the same way
Subpage
// Delete
destructiveText: ' Delete ',
destructiveButtonClicked: () => {
prompt.showDialog({
title: ' Tips ',
message: ' Delete this record ',
buttons: [
{
text: ' determine ',
color: '#ff2828'
},
{
text: ' Cancel ',
color: '#000000'
}
],
success: data => {
console.log('handling success', data.index)
if (data.index == 0) {
this.right = 0
this.$emit('delete', {
index: this.index })
prompt.showToast({
message: ' Delete successful '
})
}
Parent page
<memo memo="{
{$item}}" index="{
{$idx}}" @delete="delete" ></memo>
delete(e) {
this.memoList.splice(e.detail.index, 1)
setMemoList(this.memoList)
this.searchList=this.memoList;
},
The rest of it
cancel: function () {
console.log('handling cancel')
},
fail: function (data, code) {
console.log(`handling fail, code = ${code}`)
}
})
return true
}
})
this.timerActionSheet = setTimeout(() => {
this.$child('actionSheet').hideSheet()
}, 3000)
},
版权声明
本文为[Courtesy.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220544339295.html
边栏推荐
- es6数组的使用
- Multi process model in egg -- egg document Porter
- Laravel routing job
- 青岛敏捷之旅,来了!
- Solution of how to log in with mobile phone verification code in wireless network
- How to realize adaptive layout
- Three of three JS (webgl) simple sorting of rotation attribute function, and a simple case of rotating around the axis based on this
- After NPM was upgraded, there was a lot of panic
- PIP free export with path (@ file: / / /) notes
- 【openh264】cmake: msopenh264-static
猜你喜欢
好的测试数据管理,到底要怎么做?
How to add beautiful code blocks in word | a very complete method to sort out and compare
Cross domain CORS relationship~
My old programmer's perception of the dangers and opportunities of the times?
C#测试调用PaddleSharp模块识别图片文字
Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
Open source rule engine - Ice: dedicated to solving flexible and complex hard coding problems
Three 之 three.js (webgl)旋转属性函数的简单整理,以及基于此实现绕轴旋转的简单案例
How to set the initial value of El input number to null
引入精益管理方式,需要提前做到这九点
随机推荐
SQLyog的基本使用
Three 之 three.js (webgl)旋转属性函数的简单整理,以及基于此实现绕轴旋转的简单案例
App Store年交易额100万美元只缴15%佣金,中小开发者心里很矛盾
看板快速启动指南
2022年最热门的招聘技术技能是什么,您绝对想不到
2021-09-23
Multiple mainstream SQL queries only take the latest one of the data
了解 DevOps,必读这十本书!
Laravel routing job
selenium預先加載cookie的必要性
项目经理值得一试的思维方式:项目成功方程式
2021-11-08
(11) Vscode code formatting configuration
JS array common methods
【openh264】cmake: msopenh264-static
The annual transaction volume of the app store is US $1 million, and only 15% commission is paid. Small and medium-sized developers are very contradictory
mariadb数据库的主从复制
Excel 2016 cannot open the file for the first time. Sometimes it is blank and sometimes it is very slow. You have to open it for the second time
Log introduction and building web application
2021-10-12