Commit 4e256bae by hank

修改编辑项数据限制以及提示

parent a4c93918
<template> <template>
<div id="app"> <div id="app">
<transition :name="transitionName" > <keep-alive v-if="$route.meta.keepAlive">
<keep-alive v-show="$route.meta.keepAlive"> <router-view class="child-view" />
<router-view class="child-view"/> </keep-alive>
</keep-alive> <router-view class="child-view" v-if="!$route.meta.keepAlive" />
<router-view class="child-view" v-show="!$route.meta.keepAlive"/> <!-- <transition :name="transitionName" >
</transition>
</transition>-->
</div> </div>
</template> </template>
<script> <script>
...@@ -14,12 +14,13 @@ ...@@ -14,12 +14,13 @@
export default { export default {
data() { data() {
return { return {
transitionName: '', transitionName: "",
keepAlive: false keepAlive: false
} };
}, },
watch: { watch: {
$route: function() { $route: function() {
console.log(this.$route.meta.keepAlive)
// let isBack = this.$router.isBack // let isBack = this.$router.isBack
// if (isBack) { // if (isBack) {
// this.transitionName = 'slide-right' // this.transitionName = 'slide-right'
...@@ -32,31 +33,33 @@ export default { ...@@ -32,31 +33,33 @@ export default {
// this.$router.isBack = false // this.$router.isBack = false
} }
}, },
created () { created() {
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL) history.pushState(null, null, document.URL);
window.addEventListener( window.addEventListener(
'popstate', () => { "popstate",
console.log('popstate') () => {
this.$router.isBack = true console.log("popstate");
this.$router.isBack = true;
}, },
false false
) );
window.addEventListener( window.addEventListener(
'pushstate', () => { "pushstate",
console.log('pushstate') () => {
this.$router.isBack = false console.log("pushstate");
this.$router.isBack = false;
}, },
false false
) );
} }
} }
} };
</script> </script>
<style lang="scss"> <style lang="scss">
#app { #app {
font-family: 'Avenir', Helvetica, Arial, sans-serif; font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;
...@@ -80,7 +83,8 @@ export default { ...@@ -80,7 +83,8 @@ export default {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
} }
html, body { html,
body {
min-height: 100vh; min-height: 100vh;
} }
.slide-left-enter, .slide-left-enter,
...@@ -108,5 +112,4 @@ html, body { ...@@ -108,5 +112,4 @@ html, body {
transition: opacity 0.3s !important; transition: opacity 0.3s !important;
/* opacity: 0 !important; */ /* opacity: 0 !important; */
} }
</style> </style>
const getters = { const getters = {
sidebar: state => state.app.sidebar, sidebar: state => state.app.sidebar,
device: state => state.app.device, device: state => state.app.device,
token: state => state.user.token token: state => state.user.token,
errorData: state => state.app.errorData
} }
export default getters export default getters
...@@ -5,7 +5,8 @@ const app = { ...@@ -5,7 +5,8 @@ const app = {
opened: !+localStorage.getItem('sidebarStatus'), opened: !+localStorage.getItem('sidebarStatus'),
withoutAnimation: false withoutAnimation: false
}, },
device: 'desktop' device: 'desktop',
errorData: {}
}, },
mutations: { mutations: {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
...@@ -24,6 +25,9 @@ const app = { ...@@ -24,6 +25,9 @@ const app = {
}, },
TOGGLE_DEVICE: (state, device) => { TOGGLE_DEVICE: (state, device) => {
state.device = device state.device = device
},
SET_ERROR_DATA: (state, errorData) => {
state.errorData = errorData
} }
}, },
actions: { actions: {
......
...@@ -242,6 +242,7 @@ ...@@ -242,6 +242,7 @@
:schemaData="templateData.listData[currentPage].schemaData" :schemaData="templateData.listData[currentPage].schemaData"
:frameUrl="templateData.frameUrl" :frameUrl="templateData.frameUrl"
:templateShow="templateData.templateShow" :templateShow="templateData.templateShow"
:errorData="errorData"
@setList="setList" @setList="setList"
@setClipImg="setClipImg" @setClipImg="setClipImg"
></editMenu> ></editMenu>
...@@ -347,6 +348,7 @@ export default { ...@@ -347,6 +348,7 @@ export default {
defaultData: [], defaultData: [],
templateInfo: {} templateInfo: {}
}, },
errorData: {},
clipImg: false, clipImg: false,
editObj: {}, editObj: {},
editIndex: "", editIndex: "",
...@@ -382,7 +384,7 @@ export default { ...@@ -382,7 +384,7 @@ export default {
}, },
watch: { watch: {
currentPage: function() { // 页面改变时 改变编辑项的索引 currentPage: function() { // 页面改变时 改变编辑项的索引
this.itemListIndex = 0; this.itemListIndex = 0;
} }
}, },
activated() { // keepalive 下显示触发 activated() { // keepalive 下显示触发
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment