# 保存草稿功能开发

		// 监听页面返回
		onBackPress() {
			// 如果没有值
			if(!this.text && this.imglist.length < 1) {
				return
			}
			if(!this.isget) {
				this.baocun()
				return true
			}
		},
          	methods: {
			// 保存为草稿
			baocun() {
				uni.showModal({
				    content: '是否要保存为草稿?',
						cancelText: '不保存',
						confirmText: '保存',
				    success: (res) => {
				        if (res.confirm) {
				           console.log('保存')
				        } else {
									console.log('不保存')
								}
								this.isget = true
								uni.navigateBack({
									delta:1
								})
				    }
				});
			}
	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
上次更新: 2021/2/22 上午10:53:04