Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 620 Bytes

3-vue+react的堆栈.md

File metadata and controls

29 lines (22 loc) · 620 Bytes

调试template渲染时候的代码

方法

https://vuedose.tips/debugging-templates-in-vue-js/

This is due that everything that you placed in the template Vue try to find it in the instance so a quick solution could be put a log method in the component to allow Vue to find it: 在组件中添加方法

methods: {
    log(message): console.log(message);
}

// 在template中实现
{{ log(message) }}

如果要在多个组件中实现这一个方法, 则覆盖main.js里的方法: 1.

Vue.prototype.$log = console.log;
{{ $log() }}

打印堆栈