ruoyi-plus-soybean/src/views/home/index.vue

58 lines
1.4 KiB
Vue
Raw Normal View History

2021-08-17 14:59:59 +08:00
<template>
2021-08-18 12:02:59 +08:00
<div>
<n-space>
<n-button v-for="item in actions" :key="item.key" type="primary" @click="handleClick(item.key)">
{{ item.label }}
</n-button>
</n-space>
2021-08-27 12:00:09 +08:00
<n-space>
<n-button>Default</n-button>
<n-button type="primary">Primary</n-button>
<n-button type="info">Info</n-button>
<n-button type="success">Success</n-button>
<n-button type="warning">Warning</n-button>
<n-button type="error">Error</n-button>
</n-space>
<router-link to="/system">system</router-link>
2021-08-18 12:02:59 +08:00
</div>
2021-08-17 14:59:59 +08:00
</template>
2021-08-18 12:02:59 +08:00
<script lang="ts" setup>
2021-08-26 14:09:31 +08:00
import { useDialog, useNotification, useMessage } from 'naive-ui';
2021-08-18 12:02:59 +08:00
2021-08-26 14:09:31 +08:00
type ActionType = 'dialog' | 'notification' | 'message';
2021-08-18 12:02:59 +08:00
interface Action {
key: ActionType;
label: string;
}
2021-08-27 14:29:06 +08:00
defineProps({
code: {
type: String,
default: ''
}
});
2021-08-18 12:02:59 +08:00
const dialog = useDialog();
const notification = useNotification();
const message = useMessage();
const actions: Action[] = [
{ key: 'dialog', label: 'dialog' },
{ key: 'notification', label: 'notification' },
{ key: 'message', label: 'message' }
];
function handleClick(type: ActionType) {
if (type === 'dialog') {
dialog.info({ content: '弹窗示例!' });
}
if (type === 'notification') {
notification.info({ content: '通知示例!' });
}
if (type === 'message') {
message.info('消息示例!');
}
}
</script>
2021-08-17 14:59:59 +08:00
<style scoped></style>