mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 完成首页静态展示内容
This commit is contained in:
+38
-1
@@ -1,4 +1,4 @@
|
||||
import { h, DefineComponent } from 'vue'
|
||||
import { h } from 'vue'
|
||||
import { NIcon } from 'naive-ui'
|
||||
|
||||
/**
|
||||
@@ -18,6 +18,43 @@ export const renderIcon = (icon: any) => {
|
||||
return () => h(NIcon, null, { default: () => h(icon) })
|
||||
}
|
||||
|
||||
/**
|
||||
* * render 弹出确认框
|
||||
* @param { Function } dialogFn dialog函数,暂时必须从页面传过来
|
||||
* @param { Object} params 配置参数
|
||||
*/
|
||||
export const goDialog = (
|
||||
dialogFn: Function,
|
||||
params: {
|
||||
// 基本
|
||||
type: 'delete'
|
||||
message?: string
|
||||
onPositiveCallback?: Function
|
||||
onNegativeCallback?: Function
|
||||
// 渲染函数
|
||||
render?: boolean
|
||||
contentFn?: Function
|
||||
actionFn?: Function
|
||||
}
|
||||
) => {
|
||||
const { type, message, onPositiveCallback, onNegativeCallback } = params
|
||||
const tip = {
|
||||
delete: '是否删除此数据'
|
||||
}
|
||||
dialogFn({
|
||||
title: '提示',
|
||||
content: message || tip[type] || '',
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
onPositiveCallback && onPositiveCallback()
|
||||
},
|
||||
onNegativeClick: () => {
|
||||
onNegativeCallback && onNegativeCallback()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* * 处理 vite 中无法使用 require 的问题
|
||||
* @param name
|
||||
|
||||
Reference in New Issue
Block a user