Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
Vue.js 2 中如何将 VNode 数组插入到指定元素下?_创想鸟

Vue.js 2 中如何将 VNode 数组插入到指定元素下?

Vue.js 2 中如何将 VNode 数组插入到指定元素下?

vue.js 2 vnode数组插入到指定元素下的两种解决方案

对于问题1:

解决方案1

import Vue from "vue";import nodeRenderer from "./RenderNode";const DetailConstructor = Vue.extend(nodeRenderer);export default {  props: {    fullText: "",  },  mounted() {    // 参考 https://stackoverflow.com/a/50937178/3089701    const detailRenderer = new DetailConstructor({      propsData: {        node: this.$slots.default,      },    });    console.log(detailRenderer.$mount(), detailRenderer.$el.outerHTML); // $el是dom对象,任意操作  },};

对应RenderNode.js:

export default {  props: ["node"],  render(h, context) {    return this.node ? this.node : "";  },};

解决方案2

立即学习“前端免费学习笔记(深入)”;

const slot = this.$slots.default[0];console.log(slot.context.$mount(), slot.context.$el.innerHTML);

对于问题2:拿到DOM后,可以进行任意操作。

以上就是Vue.js 2 中如何将 VNode 数组插入到指定元素下?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1557721.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
如何将嵌套的省市区树结构扁平化为指定格式,以满足不同选择的地址获取需求?
上一篇 2025年12月22日 03:11:07
Spring Boot 项目 Mapper 接口未被扫描导致后台报错,怎么解决?
下一篇 2025年12月22日 03:11:11

相关推荐

发表回复

登录后才能评论
关注微信