Giter Site home page Giter Site logo

Comments (4)

qm3ster avatar qm3ster commented on June 12, 2024

I am very negative about this library duplicating the decorators from https://github.com/kaorun343/vue-property-decorator. At a glance, I don't see it doing anything more than that one.
I see there have recently been PRs merged to this, but they would be of more use at the origin, unless similar have already been deployed there.
Furthermore, like you pointed out, instead of importing nuxt-class-component, it just copies it to the top of the file:

import Component, { mixins, createDecorator } from 'vue-class-component';
Component.registerHooks([
'beforeRouteEnter',
'beforeRouteUpdate',
'beforeRouteLeave',
'asyncData',
'fetch',
'head',
'middleware',
'layout',
'transition',
'scrollToTop',
'validate'
])

Furthermore, due to how registerHooks is implemented, this actually contaminates the normal Component decorator, which some might import directly in non-page components.

I strongly suggest that this module be taken out behind the barn.

I know this will be controversial, as it may increase, visually, the number of inputs in some cases, but I would also vote to neuter nuxt-class-component to the following:

import Component, from 'vue-class-component'

Component.registerHooks([
  'beforeRouteEnter',
  'beforeRouteLeave',
  'asyncData',
  'fetch',
  'head',
  'middleware',
  'layout',
  'transition',
  'scrollToTop',
  'validate'
])

export Component

If someone wants to import all of vuex-class, vue-class-component, vue-property-decorators and nuxt-class-component all the time, they can re-export them themselves, in a single short file inside their project. It's not rocket surgery.

from nuxt-property-decorator.

husayt avatar husayt commented on June 12, 2024

from nuxt-property-decorator.

qm3ster avatar qm3ster commented on June 12, 2024

@husayt we can reexport the exports of vuex-class and vue-class-component, directly or from nuxt-class-component, and reexport third-party vue-property-decorators...
Or we can deprecate this module.

from nuxt-property-decorator.

husayt avatar husayt commented on June 12, 2024

Coming back to this chain as over last few months I have resolved some of the issues highlighted here. It is not using nuxt-class-component anymore. It's making it easy to write class based TS/JS components with Nuxt, unlocking all the coolness from vue-class-component , vue-property-decorator and vuex-class and adding nuxt specific hooks and decorators. Also this completely deprecates nuxt-class-component

from nuxt-property-decorator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.