|
@@ -3,7 +3,7 @@ import OHeader from '@/components/o-header'
|
|
|
import OSearch from '@/components/o-search'
|
|
|
import OSticky from '@/components/o-sticky'
|
|
|
import { ActionSheet, Button, Cell, CellGroup, Icon, Image, List, showToast } from 'vant'
|
|
|
-import { defineComponent, onMounted, reactive, ref } from 'vue'
|
|
|
+import { defineComponent, onMounted, onUnmounted, reactive, ref } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import iconEdit from '../images/icon-edit.png'
|
|
|
import iconAdd from '@common/images/icon_add.png'
|
|
@@ -12,6 +12,7 @@ import UnitListItem from './models/unit-list-item'
|
|
|
import OFullRefresh from '@/components/o-full-refresh'
|
|
|
import { state } from '@/state'
|
|
|
import request from '@/helpers/request'
|
|
|
+import { postMessage } from '@/helpers/native-message'
|
|
|
export default defineComponent({
|
|
|
name: 'unit-list',
|
|
|
setup() {
|
|
@@ -90,6 +91,18 @@ export default defineComponent({
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
getList()
|
|
|
+
|
|
|
+ // 处理返回上一页的问题
|
|
|
+ window.history.pushState(null, '', document.URL)
|
|
|
+ window.addEventListener('popstate', onBack, false)
|
|
|
+ })
|
|
|
+
|
|
|
+ const onBack = () => {
|
|
|
+ postMessage({ api: 'back' })
|
|
|
+ }
|
|
|
+
|
|
|
+ onUnmounted(() => {
|
|
|
+ window.removeEventListener('popstate', onBack)
|
|
|
})
|
|
|
|
|
|
const createUnit = () => {
|