Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead. #12194
const container = defineComponent({
setup(_, { slots }) {
/ Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead. /
return () => slots.default && slots.default();
},
});
Vue version
3.5.12
Link to minimal reproduction
https://play.vuejs.org/#eNp9U11v0zAU/SvGD2sqhRQ0eOnaIhiVAGkDAYIXS1OW3LYZjm35I3Sq8t+5dlonYVMfWsX3nHvvuV8H+l6prHFA53RhCl0pSwxYp1ZMVLWS2pID0bAhLdloWZMJUicDaAsCdG7hRpY5P5EYzWa1NzDKBBOFFMaS2mzJ0odKJp+Ac0l+S83LF5PpleeM4iRTJhazTg3qwIeFWnGE8UXIYvd6dTiEgG27mOErWCuhnCXNS8wMfMko4oySGYKL2cCfptQalLSpttmDkQILP3h/RgtZq4qD/qpshZIZnZOAeCxHxX+/BJvVDtKTvdhB8ecZ+4PZexuj3zQY0A0wGjGb6y3YDl7/uIU9fkcQ1TuO7DPgdzCSO6+xo31wokTZA15Q+znMqBLbn2a9tyDMqSgv1DPbwGcUR3p9pvRe7mX2Jvgx0WIXw4SxhdjA4aaku7TQgL3+dYuDSEvYVCLElwKETTWIEvR4nTTOGH+wD1G6dRkv1pIkU7JcoSjkkSMFvL2UhasxcNYlXXPwr2RSVo1frQHdiRvphP0/FkHRXlIiHOcpBj15EfzOVI6o9ZW8yzTUsoHrXcXLpKe1oyT12RQfq5zL7ThJLOBelo9ZrhRSn88xzIP/NsfGat+CcYuTmDUccnKX4mAMl9aQdtpL8qKs04JsnCj81L3mARrx4JphktxxSy4uxoakr6TvRditTvl4Bl0DUPMuiRWkXeNj6hj4qdTBYiVDpYyG4/cXMLCOiiHEPiqYHy/2XuJ5DuG2f/QFHY2xhjDcWPBRU8wS0CjguG2nNgSf9grP5q4B7U8Rz+Yye5u9ou0/mV/PVg==
Steps to reproduce
const container = defineComponent({ setup(_, { slots }) { / Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead. / return () => slots.default && slots.default(); }, });
What is expected?
消除上面的警告
What is actually happening?
v < 3.3.4 符合预期 v3.5.12 不符合预期,会有上面的警告
System Info
No response
Any additional comments?
No response
在setup里,直接render会出现此警告,把mount()改为nextTick(mount)可以消除警告。直接再main.js里调用是不会的。
但是:上面的情况在更早的(比如:3.3.4)版本里是没有这种情况的