Merge branch 'dev' into master-fetch-dev

This commit is contained in:
奔跑的面条 2023-02-09 16:24:19 +08:00
commit 682419d174
8 changed files with 44 additions and 16 deletions

View File

@ -3,7 +3,7 @@ import App from './App.vue'
import router, { setupRouter } from '@/router'
import i18n from '@/i18n/index'
import { setupStore } from '@/store'
import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins'
import { setupNaive, setupDirectives, setupCustomComponents, initFunction } from '@/plugins'
import { GoAppProvider } from '@/components/GoAppProvider/index'
import { setHtmlTheme } from '@/utils'
@ -53,4 +53,6 @@ async function appInit() {
window['$vue'] = app
}
void appInit()
await appInit()
await initFunction()

View File

@ -122,23 +122,28 @@ const calcData = (data: any, type?: string) => {
//
const calcCapsuleLengthAndLabelData = (dataset: any) => {
const { source } = dataset
if (!source.length) return
try {
const { source } = dataset
if (!source || !source.length) return
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
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) => {

View File

@ -40,6 +40,15 @@
<SettingItem name="列宽度">
<n-input v-model:value="columnWidth" :min="1" size="small" placeholder="列宽度(英文','分割)"></n-input>
</SettingItem>
<SettingItem name="轮播方式">
<n-select
v-model:value="optionData.carousel"
:options="[
{ label: '单条轮播', value: 'single' },
{ label: '整页轮播', value: 'page' },
]"
/>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="样式">

View File

@ -2,3 +2,4 @@ export { setupNaive } from '@/plugins/naive'
export { setupDirectives } from '@/plugins/directives'
export { setupCustomComponents } from '@/plugins/customComponents'
export { icon } from '@/plugins/icon'
export { initFunction } from '@/plugins/initFunction'

View File

@ -0,0 +1,9 @@
/**
* *
*/
export const initFunction = async () => {
// 捕获全局错误
window.addEventListener("unhandledrejection", event => {
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
});
}

View File

@ -44,7 +44,7 @@ export const clearLocalStorage = (name: string) => {
*/
export const setSessionStorage = <T>(k: string, v: T) => {
try {
window.sessionStorage.setItem(k, JSON.stringify(v))
window.sessionStorage.setItem(k, JSONStringify(v))
} catch (error) {
return false
}

View File

@ -150,7 +150,7 @@ const filterRes = computed(() => {
} catch (error) {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
errorFlag.value = true
return '过滤函数错误'
return `过滤函数错误,日志:${error}`
}
})

View File

@ -14,8 +14,10 @@
</template>
</layout-header-pro>
<n-layout-content content-style="overflow:hidden; display: flex">
<content-charts></content-charts>
<content-layers></content-layers>
<div style="overflow:hidden; display: flex">
<content-charts></content-charts>
<content-layers></content-layers>
</div>
<content-configurations></content-configurations>
</n-layout-content>
</n-layout>