Can be exclude `this` keyword in vue.js application?

vue-filter component
vue filter list example
vue filter array of objects
vue js filter
vue js example
vue js search filter
vuex
vuetify

Actually I am following Douglas Crockford jslint .

It give warning when i use this.

[jslint] Unexpected 'this'. (unexpected_a) 

I can not see any solution around for the error . Don't say add this in jslist.options and mark it true.

Is there is any approach without using this?

EDIT ADDED CODE

// some vue component here

   <script>
    export default {
      name: "RefereshPage",
      data() {
        return {
          progressValue: 0
        }
      },
      methods:{
        getRefreshQueue(loader){
          console.log(this.progressValue); // ERROR come here [jslint] Unexpected 'this'. (unexpected_a) 
      }
    }
   }
    </script>

Check out this jsfiddle. How can you avoid using this?

https://jsfiddle.net/himmsharma99/ctj4sm7f/5/

as i already stated in the comments:

using this is an integral part of how vue.js works within a component. you can read more about how it proxies and keeps track of dependencies here: https://vuejs.org/v2/api/#Options-Data

Style Guide, When overused however, they can make your code more difficult to maintain or even Component names should always be multi-word, except for root App  Debugging Vue.js applications can be difficult, especially when there are dozens, if not hundreds of mutations during a user session. If you’re interested in monitoring and tracking Vue mutations for all of your users in production, try LogRocket.

As others have said, you're better off just disabling your linter or switching to ESLint. But if you insist on a workaround, you could use a mixin and the $mount method on a vue instance to avoid using this altogether ..

    let vm;

    const weaselMixin = {
        methods: {
            getdata() {
                console.log(vm.users.foo.name);
            }
        },
        mounted: function () {
            vm.getdata();
        }
    };

    vm = new Vue({
        mixins: [weaselMixin],
        data: {
            users: {
                foo: {
                    name: "aa"
                }
            }
        }
    });

    vm.$mount('#app');

See the modified JSFiddle

As you can see, this only complicates what should be a fairly simple component. It only goes to show that you shouldn't break the way vue works just to satisfy your linter.

I would suggest you go through this article. Particularly important is this part ..

Vue.js proxies our data and methods to be available in the this context. So by writing this.firstName, we can access the firstName property within the data object. Note that this is required.

How to Create Filters in Vue.js with Examples ― Scotch.io, All you need to know about Vue.js Filters. Similar to AngularJS, Vue.js has its way of transforming data and applying filters to it, but you must How you can create and use them and couple more things you will discover going through the article. Vue.filter('without', function (values, exclude) { return  Vue.js is a versatile JavaScript Framework that has many benefits for the developer building .NET web applications. It is, however, not easy to get started with this framework. In this article, Damon Armstrong provides an introduction to Vue.js.

In the code you posted, you appear to be missing a } after getRefreshQueue definition. It's not the error your linter is describing, but maybe it got confused by the syntax error?

Building a simple data filtering app with Vue js, You can decide to use Vuejs 2 by simply invoking methods on a Vue instance or go the You can take advantage of these components in your app. Check out To changed data being displayed based on search keyword and filters selected. Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter Keywords javascript

Use of "with" keyword in vue-template-compiler · Issue #3923 · vuejs , Its use in "strict mode" is basically nil, which means that templated render functions will not work in ES6. This limits the "packagability" of Vue  Description. BootstrapVue, with more than 85 custom components, over 45 plugins, several custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js.

vuejs/vue, User can crash Vue and thus the application by simply using the curly A new tag, e.g. v-ignore-delimiters or v-disable-interpolation , to disable users (with "​avoid using JavaScript keyword as property name: "var" error). Evan You stated that, Vue.js 3.0’s code base will be rewritten entirely in TypeScript. This won’t affect ES6 developers, but it will by far improve the TypeScript experience. Generate a CLI Project. With Vue CLI 3, you can generate a new project with TypeScript already configured; just select “TypeScript” in the CLI prompt.

Models and Collections for Vue.js, This is perfectly fine for small applications, but can quickly become a lot to manage when the size of your Model instances can be created using the new keyword. object, Checks if a value is an object, excluding arrays and functions. DJANGO VUE JS. In this tutorial you will learn how to make a simple CRUD application using Vue.js 2.x and Django 2.0.2. Vue.js is progressive framework for building user interfaces while Django is

Comments
  • this does not make sense. what does the code look like that you are linting?
  • Check out the fiddle.
  • Your code seems correct, you may should consider fixing jsLint or try with esLint, (from here).
  • no, this is how vue works
  • Linters are there to help you flag potential issues, but they are not inerrant. If a rule is not useful in your particular application, you should disable it, especially for a particularly opinionated one like jsLint.
  • added } in question