element el-date-picker报错Prop being mutated:“placement“快速解决方式

报错信息

Avoid mutating a prop directly since the value will be overwritten

whenever the parent component re-renders. Instead, use a data or

computed property based on the prop's value. Prop being mutated:

"placement"

报错版本

element-ui 2.15.6 和 2.15.5 估计2.15.*都有这个问题

插件应用情况

在组件的插槽中使用el-date-picker, 组件创建时报错

最简单解决方案

在组件加上 align="center" ,就不会报错了

cpp 复制代码
<el-date-picker
   v-model="datePick"
   class="sum_pick"
   align="center"    // 加这个就可以了
   popper-class="sum_pick_popper"
   type="date"
   placeholder="选择日期"
 >
 </el-date-picker>

报错原因

element在创建该组件的时候,给父级传值过来的placement ,进行二次赋值。

相关推荐
kyriewen2 分钟前
产品经理把PRD写成“天书”,我用AI半小时重写了一遍,他当场愣住
前端·ai编程·cursor
humcomm41 分钟前
元框架的工作原理详解
前端·前端框架
canonical_entropy1 小时前
Attractor Before Harness: AI 大规模开发的方法论
前端·aigc·ai编程
zhangxingchao1 小时前
多 Agent 架构到底怎么选?从 Claude Agent Teams、Cognition/Devin 到工程落地原则
前端·人工智能·后端
IT_陈寒1 小时前
SpringBoot那个自动配置的坑,害我排查到凌晨三点
前端·人工智能·后端
Honor丶Onlyou1 小时前
VS Code 右键菜单修复记录
前端
PILIPALAPENG2 小时前
Python 语法速成指南:前端开发者视角(JS 类比版)
前端·人工智能·python
JYeontu2 小时前
轮播图不够惊艳?试下这个立体卡片轮播图
前端·javascript·css
张就是我1065922 小时前
从前端角度理解 CVE-2026-31431
前端
AGoodrMe2 小时前
swift基础之async/await
前端·ios