惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
A
About on SuperTechFans
量子位
Engineering at Meta
Engineering at Meta
B
Blog
The Cloudflare Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Y
Y Combinator Blog
J
Java Code Geeks
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

Dr34m's Blog

I Expect You To Die(我希望你死) 1,2,3 完整中文攻略 Linux换国内源 && docker安装 && 换加速镜像 随笔 pyinstaller打包的程序执行报错Failed to extract xxxx decompression resulted in return code -1 taoSync排除项简易教程 apscheduler的cron配置项 如何在绿联NAS中使用TaoSync同步我的文件到各个网盘 GB28181抓包记录 JS计算字节大小,把字节转换为KB/MB/GB/TB等 在Python中使用onvif管理摄像头,包括设备发现,获取RTSP地址,获取设备信息,截图,云台控制与缩放,设置时间 编写bat脚本实现对vue项目构建并压缩 内网穿透工具frp快速使用 CentOS 7.9 安装基础开发环境jdk redis nacos nginx mysql Pyinstaller 逆向 VUE实现复制与粘贴_获取剪切板内容 Electron + xterm.js + node-pty + vue 实现本地终端 child_process exec 中文乱码 Windows&Linux 解决方法 yum 更新 gcc CentOS安装并使用conda 将fluid主题博客的静态资源由第三方改为本地存储 一个上手即用的通用公众号/小程序/h5/app框架 python批量转化doc到docx SpringBoot单元测试注入空指针 TensorFlow 预测出现NaN的一种可能以及解决方法 随笔 python归一化数据 windows下python安装sasl遇到的问题及解决 将对象List中的某个字段放到新的List中[转载] Python http.server 本地服务支持跨域 TensorFlow入门
Vue3 + Element-Plus 极简速查
Dr3@m · 2026-01-12 · via Dr34m's Blog

Vue3

onMounted

1
2
3
4
import { onMounted } from 'vue';
onMounted(() => {
console.log('页面加载完成');
})

defineProps

1
2
3
4
5
6
7
8
9
10
const props = defineProps({
title: {
type: String,
default: '创建策略'
}
})

const getData = () => {
let lm = props.title;
}

1
2
3
<span>
{{title}}
</span>

watch

1
2
3
4
5
6
7
8
9
10
11
import { watch } from "vue";
watch(() => props.title, (newTitle) => {
console.log('newTitle', newTitle);
}, {
deep: true, // 深度
immediate: true // 首次也执行
});
const titleVal = ref('');
watch(titleVal, (newVal, oldVal) => {
console.log('titleVal', newVal);
});

defineExpose

1
2
3
4
5
6
7
// rst.vue
const getData = () => {
console.log('getData');
}
defineExpose({
getData
})
1
2
3
4
const rstRef = ref();
const getIt = () => {
rstRef.value.getData();
}
1
<rst ref="rstRef"></rst>

defineEmits

1
2
3
4
5
// rst.vue
const emit = defineEmits(['closeDialog'])
const close = () => {
emit('closeDialog', true);
}
1
2
3
4
const doSth = (flag) => {
console.log('flag', flag);
}
import rst from './components/rst.vue';
1
<rst @closeDialog="doSth"></rst>

Element-Plus

ElMessageBox

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { ElMessage, ElMessageBox } from 'element-plus';
const delItem = (id) => {
ElMessageBox.confirm('删除后不可恢复,确认删除吗?', '危险', {
cancelButtonText: '取消',
confirmButtonText: '确定',
cancelButtonType: 'success',
confirmButtonType: 'danger'
}).then(() => {
loading.value = true;
deleteIt(id).then(res => {
ElMessage({
type: 'success',
message: res.msg,
})
getData();
}).finally(() => {
loading.value = false;
})
}).catch(() => { })
}

el-table

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const getData = () => {
// do
}
const params = ref({
pageNum: 1,
pageSize: 15
})
const tableData = ref({
dataList: [],
count: 0
})
const handleSizeChange = (val) => {
params.value.pageSize = val;
getData();
}
const handleCurrentChange = (val) => {
params.value.pageNum = val;
getData();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<div class="center-main">
<el-table v-loading="loading" current-row-key="id" :data="tableData.dataList" stripe
style="width: 100%;height: 100%">
<el-table-column type="index" label="序号" width="60" />
<el-table-column prop="name" label="策略名称" />
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button type="danger" size="small" @click="delItem(scope.row.id)">删除</el-button>
<el-button type="primary" size="small" @click="showConfig(scope.row.id)">配置</el-button>
</template>
</el-table-column>
</el-table>
<div class="page-box">
<el-pagination layout="total, sizes, prev, pager, next, jumper" :background="true"
v-model:page-size="params.pageSize" :page-sizes="[15, 50, 300, 500]"
v-model:current-page="params.pageNum" :total="tableData.count"
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
</div>

el-dialog

1
2
3
4
5
6
7
const dialogShow = ref(false);
const showDialog = () => {
dialogShow.value = true;
}
const closeDialog = () => {
dialogShow.value = false;
}
1
2
3
4
5
6
7
8
9
<el-dialog top="7vh" :fullscreen="false" :before-close="closeDialog"
v-model="dialogShow" width="1200px" title="Dialog"
:append-to-body="true" :close-on-click-modal="false">
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="closeDialog">我已知晓</el-button>
</span>
</template>
</el-dialog>