mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	Merge branch 'main' into gitee
This commit is contained in:
		
						commit
						0bb0026974
					
				
							
								
								
									
										10
									
								
								.github/workflows/linter.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/linter.yml
									
									
									
									
										vendored
									
									
								
							@ -13,14 +13,14 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout repository
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Install Node.js
 | 
			
		||||
        uses: actions/setup-node@v3
 | 
			
		||||
        uses: actions/setup-node@v4
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 18
 | 
			
		||||
          node-version: 20
 | 
			
		||||
 | 
			
		||||
      - uses: pnpm/action-setup@v2
 | 
			
		||||
      - uses: pnpm/action-setup@v3
 | 
			
		||||
        name: Install pnpm
 | 
			
		||||
        id: pnpm-install
 | 
			
		||||
        with:
 | 
			
		||||
@ -33,7 +33,7 @@ jobs:
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
 | 
			
		||||
 | 
			
		||||
      - uses: actions/cache@v3
 | 
			
		||||
      - uses: actions/cache@v4
 | 
			
		||||
        name: Setup pnpm cache
 | 
			
		||||
        with:
 | 
			
		||||
          path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ const footerButtons = computed(() => {
 | 
			
		||||
            type: "primary",
 | 
			
		||||
            text: true,
 | 
			
		||||
            bg: true,
 | 
			
		||||
            popconfirm: options?.popconfirm,
 | 
			
		||||
            btnClick: ({ dialog: { options, index } }) => {
 | 
			
		||||
              const done = () =>
 | 
			
		||||
                closeDialog(options, index, { command: "sure" });
 | 
			
		||||
@ -149,19 +150,34 @@ function handleClose(
 | 
			
		||||
        <component :is="options?.footerRenderer({ options, index })" />
 | 
			
		||||
      </template>
 | 
			
		||||
      <span v-else>
 | 
			
		||||
        <el-button
 | 
			
		||||
          v-for="(btn, key) in footerButtons(options)"
 | 
			
		||||
          :key="key"
 | 
			
		||||
          v-bind="btn"
 | 
			
		||||
          @click="
 | 
			
		||||
            btn.btnClick({
 | 
			
		||||
              dialog: { options, index },
 | 
			
		||||
              button: { btn, index: key }
 | 
			
		||||
            })
 | 
			
		||||
          "
 | 
			
		||||
        >
 | 
			
		||||
          {{ btn?.label }}
 | 
			
		||||
        </el-button>
 | 
			
		||||
        <template v-for="(btn, key) in footerButtons(options)" :key="key">
 | 
			
		||||
          <el-popconfirm
 | 
			
		||||
            v-if="btn.popconfirm"
 | 
			
		||||
            v-bind="btn.popconfirm"
 | 
			
		||||
            @confirm="
 | 
			
		||||
              btn.btnClick({
 | 
			
		||||
                dialog: { options, index },
 | 
			
		||||
                button: { btn, index: key }
 | 
			
		||||
              })
 | 
			
		||||
            "
 | 
			
		||||
          >
 | 
			
		||||
            <template #reference>
 | 
			
		||||
              <el-button v-bind="btn">{{ btn?.label }}</el-button>
 | 
			
		||||
            </template>
 | 
			
		||||
          </el-popconfirm>
 | 
			
		||||
          <el-button
 | 
			
		||||
            v-else
 | 
			
		||||
            v-bind="btn"
 | 
			
		||||
            @click="
 | 
			
		||||
              btn.btnClick({
 | 
			
		||||
                dialog: { options, index },
 | 
			
		||||
                button: { btn, index: key }
 | 
			
		||||
              })
 | 
			
		||||
            "
 | 
			
		||||
          >
 | 
			
		||||
            {{ btn?.label }}
 | 
			
		||||
          </el-button>
 | 
			
		||||
        </template>
 | 
			
		||||
      </span>
 | 
			
		||||
    </template>
 | 
			
		||||
  </el-dialog>
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,13 @@ type ArgsType = {
 | 
			
		||||
  /** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */
 | 
			
		||||
  command: "cancel" | "sure" | "close";
 | 
			
		||||
};
 | 
			
		||||
type ButtonType =
 | 
			
		||||
  | "primary"
 | 
			
		||||
  | "success"
 | 
			
		||||
  | "warning"
 | 
			
		||||
  | "danger"
 | 
			
		||||
  | "info"
 | 
			
		||||
  | "text";
 | 
			
		||||
 | 
			
		||||
/** https://element-plus.org/zh-CN/component/dialog.html#attributes */
 | 
			
		||||
type DialogProps = {
 | 
			
		||||
@ -58,6 +65,34 @@ type DialogProps = {
 | 
			
		||||
  destroyOnClose?: boolean;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//element-plus.org/zh-CN/component/popconfirm.html#attributes
 | 
			
		||||
type Popconfirm = {
 | 
			
		||||
  /** 标题 */
 | 
			
		||||
  title?: string;
 | 
			
		||||
  /** 确认按钮文字 */
 | 
			
		||||
  confirmButtonText?: string;
 | 
			
		||||
  /** 取消按钮文字 */
 | 
			
		||||
  cancelButtonText?: string;
 | 
			
		||||
  /** 确认按钮类型,默认 `primary` */
 | 
			
		||||
  confirmButtonType?: ButtonType;
 | 
			
		||||
  /** 取消按钮类型,默认 `text` */
 | 
			
		||||
  cancelButtonType?: ButtonType;
 | 
			
		||||
  /** 自定义图标,默认 `QuestionFilled` */
 | 
			
		||||
  icon?: string | Component;
 | 
			
		||||
  /** `Icon` 颜色,默认 `#f90` */
 | 
			
		||||
  iconColor?: string;
 | 
			
		||||
  /** 是否隐藏 `Icon`,默认 `false` */
 | 
			
		||||
  hideIcon?: boolean;
 | 
			
		||||
  /** 关闭时的延迟,默认 `200` */
 | 
			
		||||
  hideAfter?: number;
 | 
			
		||||
  /** 是否将 `popover` 的下拉列表插入至 `body` 元素,默认 `true` */
 | 
			
		||||
  teleported?: boolean;
 | 
			
		||||
  /** 当 `popover` 组件长时间不触发且 `persistent` 属性设置为 `false` 时, `popover` 将会被删除,默认 `false` */
 | 
			
		||||
  persistent?: boolean;
 | 
			
		||||
  /** 弹层宽度,最小宽度 `150px`,默认 `150` */
 | 
			
		||||
  width?: string | number;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
type BtnClickDialog = {
 | 
			
		||||
  options?: DialogOptions;
 | 
			
		||||
  index?: number;
 | 
			
		||||
@ -86,6 +121,8 @@ type ButtonProps = {
 | 
			
		||||
  round?: boolean;
 | 
			
		||||
  /** 是否为圆形按钮,默认 `false` */
 | 
			
		||||
  circle?: boolean;
 | 
			
		||||
  /** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */
 | 
			
		||||
  popconfirm?: Popconfirm;
 | 
			
		||||
  /** 是否为加载中状态,默认 `false` */
 | 
			
		||||
  loading?: boolean;
 | 
			
		||||
  /** 自定义加载中状态图标组件 */
 | 
			
		||||
@ -123,6 +160,8 @@ interface DialogOptions extends DialogProps {
 | 
			
		||||
  props?: any;
 | 
			
		||||
  /** 是否隐藏 `Dialog` 按钮操作区的内容 */
 | 
			
		||||
  hideFooter?: boolean;
 | 
			
		||||
  /** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */
 | 
			
		||||
  popconfirm?: Popconfirm;
 | 
			
		||||
  /**
 | 
			
		||||
   * @description 自定义对话框标题的内容渲染器
 | 
			
		||||
   * @see {@link https://element-plus.org/zh-CN/component/dialog.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%B4%E9%83%A8}
 | 
			
		||||
 | 
			
		||||
@ -55,10 +55,8 @@ export const useUserStore = defineStore({
 | 
			
		||||
      return new Promise<UserResult>((resolve, reject) => {
 | 
			
		||||
        getLogin(data)
 | 
			
		||||
          .then(data => {
 | 
			
		||||
            if (data) {
 | 
			
		||||
              setToken(data.data);
 | 
			
		||||
              resolve(data);
 | 
			
		||||
            }
 | 
			
		||||
            if (data?.success) setToken(data.data);
 | 
			
		||||
            resolve(data);
 | 
			
		||||
          })
 | 
			
		||||
          .catch(error => {
 | 
			
		||||
            reject(error);
 | 
			
		||||
 | 
			
		||||
@ -280,6 +280,16 @@ function onUpdateClick() {
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// popconfirm 确认框
 | 
			
		||||
function onPopconfirmClick() {
 | 
			
		||||
  addDialog({
 | 
			
		||||
    width: "30%",
 | 
			
		||||
    title: "popconfirm确认框示例",
 | 
			
		||||
    popconfirm: { title: "是否确认修改当前数据" },
 | 
			
		||||
    contentRenderer: () => <p>点击右下方确定按钮看看效果吧</p>
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 结合Form表单(第一种方式,弹框关闭立刻恢复初始值)通过 props 属性接收子组件的 prop 并赋值
 | 
			
		||||
function onFormOneClick() {
 | 
			
		||||
  addDialog({
 | 
			
		||||
@ -496,6 +506,7 @@ function onBeforeSureClick() {
 | 
			
		||||
      <el-button @click="onCloseCallBackClick"> 关闭后的回调 </el-button>
 | 
			
		||||
      <el-button @click="onNestingClick"> 嵌套的弹框 </el-button>
 | 
			
		||||
      <el-button @click="onUpdateClick"> 更改弹框自身属性值 </el-button>
 | 
			
		||||
      <el-button @click="onPopconfirmClick">popconfirm确认框</el-button>
 | 
			
		||||
    </el-space>
 | 
			
		||||
    <el-divider />
 | 
			
		||||
    <el-space wrap>
 | 
			
		||||
 | 
			
		||||
@ -81,6 +81,8 @@ const onLogin = async (formEl: FormInstance | undefined) => {
 | 
			
		||||
                })
 | 
			
		||||
                .finally(() => (disabled.value = false));
 | 
			
		||||
            });
 | 
			
		||||
          } else {
 | 
			
		||||
            message("登录失败", { type: "error" });
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        .finally(() => (loading.value = false));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user