提交 0212bfe1 编写于 作者: neko's avatar neko

修改报错提示友好

上级 6267c71b
......@@ -6,7 +6,7 @@
export const getAppView = (state: any) => (viewtag: string) => {
const createdview = state.createdviews.find((appview: any) => Object.is(appview.secondtag, viewtag));
if (!createdview) {
console.log(`----视图 ${viewtag} 不存在-----`)
console.warn(`获取应用视图实例,,视图「${viewtag}」不存在`)
return null;
}
return createdview;
......@@ -20,7 +20,7 @@ export const getAppView = (state: any) => (viewtag: string) => {
export const getViewDataChangeState = (state:any) => (viewtag: string) => {
const createdview = state.createdviews.find((appview: any) => Object.is(appview.secondtag, viewtag));
if (!createdview) {
console.log(`----视图 ${viewtag} 不存在-----`)
console.warn(`获取视图数据状态,,视图「${viewtag}」不存在`)
return false;
}
return createdview.viewdatachange;
......@@ -34,7 +34,7 @@ export const getViewDataChangeState = (state:any) => (viewtag: string) => {
export const getRefreshData = (state: any) => (viewtag: string) => {
const createdview = state.createdviews.find((appview: any) => Object.is(appview.secondtag, viewtag));
if (!createdview) {
console.log(`----视图 ${viewtag} 不存在-----`)
console.warn(`获取数据刷新状态,视图「${viewtag}」不存在`)
return null;
}
return createdview.refreshdata;
......
......@@ -6,15 +6,10 @@
* @param param1
*/
export const createdView = (state: any, { viewtag, secondtag }: { viewtag: string, secondtag: string }) => {
// 该视图是否被创建
// const index = state.createdviews.findIndex((view: any) => Object.is(view.secondtag, viewtag));
// if (index !== -1) {
// return;
// }
// 原始数据中是否存在
const appview = state.appviews.find((appview: any) => Object.is(appview.viewtag, viewtag));
if (!appview) {
console.log(`----视图标识 ${viewtag} 不存在-----`)
console.warn(`视图「${viewtag}」原始数据不存在`);
return;
}
const _appview: any = JSON.parse(JSON.stringify(appview));
......@@ -48,7 +43,7 @@ export const removeView = (state: any, viewtag: string) => {
export const setViewDataChange = (state: any, { viewtag, viewdatachange }: { viewtag: string, viewdatachange: boolean }) => {
const createdview = state.createdviews.find((appview: any) => Object.is(appview.secondtag, viewtag));
if (!createdview) {
console.log(`----视图标识 ${viewtag} 不存在-----`)
console.warn(`设置数据状态变更,视图「${viewtag}」不存在`)
return;
}
createdview.viewdatachange = viewdatachange;
......@@ -63,7 +58,7 @@ export const setViewDataChange = (state: any, { viewtag, viewdatachange }: { vie
export const refreshViewData = (state: any, { viewtag }: { viewtag: string }) => {
const createdview = state.createdviews.find((appview: any) => Object.is(appview.secondtag, viewtag));
if (!createdview) {
console.log(`----视图标识 ${viewtag} 不存在-----`)
console.warn(`刷新视图数据,视图「${viewtag}」不存在`)
return;
}
createdview.refreshdata += 1;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册