Extensions for Vue

Original post url:https://www.cnblogs.com/markjiang7m2/p/10833790.html

If you are doing vue development, there are some extensions for you to improve the development performance.

  • Vetur
  • Debugger for Chrome
  • Vue Devtools

Vetur

This is a VS Code extension. It supports Syntax-highlighting and Formatting for vue. After install the extension, you can see the code is highlight and the file is identified as vue.

How to use?

1.Install vetur

Click Ctrl + P, input ext install vetur, then install the extension.

2.Add the below in User settings

Click Ctrl + Shift + P, input Preferences: Open User Settings.

Add the below in User settings

"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
}

More details see in Vetur.

Debugger for Chrome

This is a VS Code extension. As vue js code will be compiled in browser when we debug the vue application. We could not set a breakpoint in browser. It supports us to debug and set breakpoint in VS Code, like F12 function in Chrome.

How to use?

1.Install vetur

Click Ctrl + P, input ext install Debugger for Chrome, then install the extension.

2.Update Webpack configuration to build up source map.

Open config/index.js and update devtool property as below.

devtool: 'source-map',

3.Add Chrome debug configuration.

Click Debug icon in Activity Bar. Add configuration as below.

{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8090",
"webRoot": "${workspaceFolder}/Vue.Router/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}
]
}

Change name as what you like. url should be the same as your vue application root url. webRoot is your vue application src path.

4.Run the vue application as usual.

npm run dev

5.Start Debugging.

Click Debug icon in Activity Bar and click the green button.

Then you can make breakpoint in VS Code.

Vue Devtools

This is a Chrome extension. It helps us to get more details when we debug the vue application.

Actually most of the blogs tell me how to install the extension while few of them can show me how to use the tool.

I find a blog is useful for me. Here is the original link:https://flaviocopes.com/vue-devtools/.

How to use?

1.Install Vue Devtools

There are 2 ways to install the Vue Dev Tools:

  • Add on Google Chrome Store directly.

  • Manual Installation

    If the Google Chrome Store is not avaible for you, you can try this way.

    Clone the repository from Github and build it. You can follow the document to install the extension.

2.How to use the Developer Tools?

After install the extension, you can use it in Chrome.

Start a vue application in developing mode and access it in Chrome. Click F12. When the Vue DevTools panel is open, we can navigate the components tree. When we choose a component from the list on the left, the right panel shows the props and data it holds:

On the top there are 4 buttons:

  • Components (the current panel), which lists all the component instances running in the current page. Vue can have multiple instances running at the same time, for example it might manage your shopping cart widget and the slideshow, with separate, lightweight apps.
  • Vuex is where you can inspect the state managed through Vuex.
  • Events shows all the events emitted
  • Refresh reloads the devtools panel

Notice the small = $vm0 text beside a component? It’s a handy way to inspect a component using the Console. Pressing the “esc” key shows up the console in the bottom of the devtools, and you can type $vm0 to access the Vue component:

  • Filter components

    Start typing a component name, and the components tree will filter out the ones that don’t match.

  • Select component in the page

    Click the button and you can hover any component in the page with the mouse, click it, and it will be opened in the devtools.

  • Filter inspected data

    On the right panel, you can type any word to filter the properties that don’t match it.

  • nspect DOM

    Click the Inspect DOM button to be brought to the DevTools Elements inspector, with the DOM element generated by the component:

Reference:

https://flaviocopes.com/vue-devtools/

Extensions for Vue的更多相关文章

  1. webpack构建vue项目(再谈配置)

    webpack配置起来确实麻烦,这不,之前用刚配好了vue1+的版本,结果在(部分)安卓机上测试,发现存在开启热加载(dev-server)的情况下不能识别vue语法的问题,试了很多方法,都没能很好的 ...

  2. webpack构建vue项目(配置篇)

    最近公司要求用vue重构项目,还涉及到模块化开发,于是乎,我专门花了几天的时间研究了一下webpack这个目前来看比较热门的模块加载兼打包工具,发现上手并不是很容易,现将总结的一些有关配置的心得分享出 ...

  3. 基于webpack和vue.js搭建开发环境

    前言 在对着产品高举中指怒发心中之愤后,真正能够解决问题的是自身上的改变,有句话说的好:你虽然改变不了全世界,但是你有机会改变你自己.秉承着“不听老人言,吃亏在眼前”的优良作风,我还是决定玩火自焚. ...

  4. vue 配置文件详解

    var path = require('path'); // NodeJS中的Path对象,用于处理目录的对象,提高开发效率. // 模块导入 module.exports = { // 入口文件地址 ...

  5. webpack入坑之旅(五)加载vue单文件组件

    这是一系列文章,此系列所有的练习都存在了我的github仓库中vue-webpack,在本人有了新的理解与认识之后,会对文章有不定时的更正与更新.下面是目前完成的列表: webpack入坑之旅(一)不 ...

  6. vue项目引入bootstrap、jquery

    在进行vue的学习,项目中需要引入bootstrap.jquery的步骤. 一.引入jQuery 在当前项目的目录下(就是package.json),运行命令 cnpm install jquery ...

  7. Vue 开发常见问题集锦

    涉及技术栈 CLI: Vue-CLI UI: Element HTML: Pug(Jade) CSS: Less JavaScript: ES6 正文: polyfill 与 transform-ru ...

  8. 【vue系列之二】详解vue-cli 2.0配置文件

    上次给大家分享的是用vue-cli快速搭建vue项目,虽然很省时间和精力,但想要真正搞明白,我们还需要对其原理一探究竟. 大家拿到一个项目,要快速上手,正确的思路是这样的: 首先,如果在项目有read ...

  9. 基于Vue.js的大型报告页项目实现过程及问题总结(一)

    今年5月份的时候做了一个测评报告项目,需要在网页正常显示的同时且可打印为pdf,当时的技术方案采用jquery+template的方式,因为是固定模板所以并没有考虑报告的模块化区分,九月底产品提出新的 ...

随机推荐

  1. Delphi - 数组和结构体

    技术交流,DH讲解. 记得很早之前我就说过,数组和结构体在内存中其实一样的,他们都是连续分布的.例如: ? 1 2 3 4 TMyStruct = record   A,B,C:Integer; en ...

  2. 手把手编写PHP框架 深入了解MVC运行流程

    1 什么是MVC MVC模式(Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Controller ...

  3. shingling算法——提取特征,m个hash函数做指纹计算,针对特征hash后变成m维向量,最后利用union-find算法计算相似性

    shingling算法用于计算两个文档的相似度,例如,用于网页去重.维基百科对w-shingling的定义如下: In natural language processing a w-shinglin ...

  4. HihoCoder 1636

    /** * 题目链接:https://cn.vjudge.net/problem/HihoCoder-1636 * 题目意思,石子合并,每次可以合并相邻的石子.每次可以x堆合并为一堆. * x属于[l ...

  5. 关于C++多态的理解

    多态,即多种形态.对于具有继承关系的一类对象,子类表现出了父类的某些特性,但是表现的不一样,这就是多态的现实体现.例如动物可以发声,但是狗是旺旺,狗是动物的一种,但是表现了不同的叫的特点,这就是多态. ...

  6. 数据库ACID和mvcc

    一.数据库的ACID性: 原子性(atomicity).一致性(consistency).隔离性(isolation).持久性(durability). 二.原子性 1.原子性:一个事务要么全部完成, ...

  7. L2-016 愿天下有情人都是失散多年的兄妹(25 分)

    呵呵.大家都知道五服以内不得通婚,即两个人最近的共同祖先如果在五代以内(即本人.父母.祖父母.曾祖父母.高祖父母)则不可通婚.本题就请你帮助一对有情人判断一下,他们究竟是否可以成婚? 输入格式: 输入 ...

  8. ACM学习历程—广东工业大学2016校赛决赛-网络赛E 积木积水(最值问题 || 动态规划)

    题目链接:http://gdutcode.sinaapp.com/problem.php?cid=1031&pid=4 这个题目自然会考虑到去讨论最长或者最短的板子. 笔上大概模拟一下的话,就 ...

  9. ACM学习历程—HDU5423 Rikka with Tree(搜索)

    Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he ...

  10. 洛谷【P1175】表达式的转换

    浅谈栈:https://www.cnblogs.com/AKMer/p/10278222.html 题目传送门:https://www.luogu.org/problemnew/show/P1175 ...