Skip to content

Commit bbe623b

Browse files
committed
fix: #62 display a message if user delete the page if only one page;
当只有一页的时候,提示用户至少需要保留一页
1 parent 99652fe commit bbe623b

File tree

1 file changed

+18
-1
lines changed
  • front-end/h5/src/store/modules

1 file changed

+18
-1
lines changed

front-end/h5/src/store/modules/page.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
* @Author: ly525
3+
* @Date: 2019-12-08 17:05:09
4+
* @LastEditors: ly525
5+
* @LastEditTime: 2019-12-15 15:41:56
6+
* @FilePath: /luban-h5/front-end/h5/src/store/modules/page.js
7+
* @Github: https://github.com/ly525/luban-h5
8+
* @Description: page module
9+
* @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10+
*/
11+
import { message } from 'ant-design-vue'
12+
113
import Page from '../../components/core/models/page'
214

315
// actions
@@ -29,7 +41,12 @@ export const mutations = {
2941
state.work.pages.push(state.editingPage.clone())
3042
break
3143
case 'delete':
32-
if (state.work.pages.length === 1) return // #!zh: 作品中至少需要保留一个页面,TODO 需要在页面中提示用户此信息
44+
if (state.work.pages.length === 1) {
45+
// #!zh: 作品中至少需要保留一个页面
46+
// #!en: At least one page needs to be kept in the work
47+
message.info(`作品中至少需要保留一个页面`)
48+
return
49+
}
3350

3451
const { work, editingPage } = state
3552
let index = work.pages.findIndex(page => page.uuid === editingPage.uuid)

0 commit comments

Comments
 (0)