Merge branch 'dev' into master-fetch-dev
This commit is contained in:
commit
682419d174
@ -3,7 +3,7 @@ import App from './App.vue'
|
|||||||
import router, { setupRouter } from '@/router'
|
import router, { setupRouter } from '@/router'
|
||||||
import i18n from '@/i18n/index'
|
import i18n from '@/i18n/index'
|
||||||
import { setupStore } from '@/store'
|
import { setupStore } from '@/store'
|
||||||
import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins'
|
import { setupNaive, setupDirectives, setupCustomComponents, initFunction } from '@/plugins'
|
||||||
import { GoAppProvider } from '@/components/GoAppProvider/index'
|
import { GoAppProvider } from '@/components/GoAppProvider/index'
|
||||||
import { setHtmlTheme } from '@/utils'
|
import { setHtmlTheme } from '@/utils'
|
||||||
|
|
||||||
@ -53,4 +53,6 @@ async function appInit() {
|
|||||||
window['$vue'] = app
|
window['$vue'] = app
|
||||||
}
|
}
|
||||||
|
|
||||||
void appInit()
|
await appInit()
|
||||||
|
|
||||||
|
await initFunction()
|
||||||
|
@ -122,23 +122,28 @@ const calcData = (data: any, type?: string) => {
|
|||||||
|
|
||||||
// 数据解析
|
// 数据解析
|
||||||
const calcCapsuleLengthAndLabelData = (dataset: any) => {
|
const calcCapsuleLengthAndLabelData = (dataset: any) => {
|
||||||
const { source } = dataset
|
try {
|
||||||
if (!source.length) return
|
const { source } = dataset
|
||||||
|
if (!source || !source.length) return
|
||||||
|
|
||||||
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
||||||
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
|
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
|
||||||
|
|
||||||
const maxValue = Math.max(...capsuleValue)
|
const maxValue = Math.max(...capsuleValue)
|
||||||
|
|
||||||
state.capsuleValue = capsuleValue
|
state.capsuleValue = capsuleValue
|
||||||
|
|
||||||
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
|
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
|
||||||
|
|
||||||
const oneFifth = maxValue / 5
|
const oneFifth = maxValue / 5
|
||||||
|
|
||||||
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
|
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
|
||||||
|
|
||||||
state.labelData = labelData
|
state.labelData = labelData
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberSizeHandle = (val: string | number) => {
|
const numberSizeHandle = (val: string | number) => {
|
||||||
|
@ -40,6 +40,15 @@
|
|||||||
<SettingItem name="列宽度">
|
<SettingItem name="列宽度">
|
||||||
<n-input v-model:value="columnWidth" :min="1" size="small" placeholder="列宽度(英文','分割)"></n-input>
|
<n-input v-model:value="columnWidth" :min="1" size="small" placeholder="列宽度(英文','分割)"></n-input>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
<SettingItem name="轮播方式">
|
||||||
|
<n-select
|
||||||
|
v-model:value="optionData.carousel"
|
||||||
|
:options="[
|
||||||
|
{ label: '单条轮播', value: 'single' },
|
||||||
|
{ label: '整页轮播', value: 'page' },
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
|
|
||||||
<SettingItemBox name="样式">
|
<SettingItemBox name="样式">
|
||||||
|
@ -2,3 +2,4 @@ export { setupNaive } from '@/plugins/naive'
|
|||||||
export { setupDirectives } from '@/plugins/directives'
|
export { setupDirectives } from '@/plugins/directives'
|
||||||
export { setupCustomComponents } from '@/plugins/customComponents'
|
export { setupCustomComponents } from '@/plugins/customComponents'
|
||||||
export { icon } from '@/plugins/icon'
|
export { icon } from '@/plugins/icon'
|
||||||
|
export { initFunction } from '@/plugins/initFunction'
|
||||||
|
9
src/plugins/initFunction.ts
Normal file
9
src/plugins/initFunction.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* * 页面初始化就执行的函数
|
||||||
|
*/
|
||||||
|
export const initFunction = async () => {
|
||||||
|
// 捕获全局错误
|
||||||
|
window.addEventListener("unhandledrejection", event => {
|
||||||
|
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
|
||||||
|
});
|
||||||
|
}
|
@ -44,7 +44,7 @@ export const clearLocalStorage = (name: string) => {
|
|||||||
*/
|
*/
|
||||||
export const setSessionStorage = <T>(k: string, v: T) => {
|
export const setSessionStorage = <T>(k: string, v: T) => {
|
||||||
try {
|
try {
|
||||||
window.sessionStorage.setItem(k, JSON.stringify(v))
|
window.sessionStorage.setItem(k, JSONStringify(v))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ const filterRes = computed(() => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
errorFlag.value = true
|
errorFlag.value = true
|
||||||
return '过滤函数错误'
|
return `过滤函数错误,日志:${error}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -14,8 +14,10 @@
|
|||||||
</template>
|
</template>
|
||||||
</layout-header-pro>
|
</layout-header-pro>
|
||||||
<n-layout-content content-style="overflow:hidden; display: flex">
|
<n-layout-content content-style="overflow:hidden; display: flex">
|
||||||
<content-charts></content-charts>
|
<div style="overflow:hidden; display: flex">
|
||||||
<content-layers></content-layers>
|
<content-charts></content-charts>
|
||||||
|
<content-layers></content-layers>
|
||||||
|
</div>
|
||||||
<content-configurations></content-configurations>
|
<content-configurations></content-configurations>
|
||||||
</n-layout-content>
|
</n-layout-content>
|
||||||
</n-layout>
|
</n-layout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user