Commit bbe623b438f87582dd790438b1211f09f7b6c7e0

Authored by ly525
1 parent 99652fef

fix: #62 display a message if user delete the page if only one page;

当只有一页的时候,提示用户至少需要保留一页
front-end/h5/src/store/modules/page.js
  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 +
1 13 import Page from '../../components/core/models/page'
2 14  
3 15 // actions
... ... @@ -29,7 +41,12 @@ export const mutations = {
29 41 state.work.pages.push(state.editingPage.clone())
30 42 break
31 43 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 + }
33 50  
34 51 const { work, editingPage } = state
35 52 let index = work.pages.findIndex(page => page.uuid === editingPage.uuid)
... ...