gerexpress.blogg.se

Vue js
Vue js










vue js

(“Block” refers to conditional block, for loop block, etc.)įor example, using let in a conditional block will scope the variable within the block, and it will not be available outside of it. Let is like var but the variables declared with let are scoped within the block where they’re declared. They’re so ubiquitous that even IE 11 supports them. Let’s start with the most ubiquitous features of ES6: let and const. Actually, that’s not entirely true, IE 11 does support a few ES6 features, such as the let and const keyword. If we empty out the "browserslist" array, there will be no support for IE 11 if we intend to use any of the ES6 features we’ll get into in this article.

vue js

This default config covers many outdated browsers, including IE 11. For now, just be aware that this is the config that tells babel what browsers to support.

vue js

There’s a lot of magic going on under the hood, and we’ll get into the details of transpilation and polyfill in another article. If you search inside the package.json file, you’ll find a field called browserslist: "browserslist": [ (There’s no IE 11 support for Vue 3 because the Composition API is using Proxy, which isn’t supported by babel/core-js.) Let’s create a new Vue app for demonstration: vue create es6-appĬhoose the Default Vue 2 option from the prompt. Here’s the list of ES6 features we’ll go through:īefore we begin, let’s shed some light at how Vue is supporting Internet Explorer 11. In this article, we’ll be focusing on the first category: all the essential features that you can use in your Vue apps to improve your programming experience. Features that even Chrome and Firefox don’t currently support, namely Tail Call Optimization.Features you can use but you would need to drop supports for IE 11 (and lower) because Babel and core-js won’t transpile/polyfill them for you, mainly proxy and subclassing of native types.Features you can use and never have to worry about compatibility (when Babel and core-js are used).Here are three categories of these ES6 features (categorized by browser compatibility): The good news is: you can actually use most of these features with the help of Babel and core-js, which are already available to you in a Vue CLI-generated app. You might be thinking that you can’t use them because there is a lack of support for IE 11. ECMAScript 6, the so-called modern JavaScript, is packed with powerful features such as block scope, class, arrow function, generator, and many other useful things.












Vue js