Giter Site home page Giter Site logo

vuety's People

Contributors

strantr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

luozhihua

vuety's Issues

New Provide and Inject decorators

Add decorators for the new provide/inject functionality https://vuejs.org/v2/api/#provide-inject

Ancestor:

@Provide("name") 
@Data public field : string; // Specific name

@Provide 
@Data public field1 : string; // Auto name

Descendant:

@Inject("name") public field: string; // Specific name
@Inject public field1: string; // Auto name

Provided properties cannot be referenced

@Component({
    template: `<div>{{data}}</div>`
}) export class Layout extends Vue {
    @Provide public get data() {
        return "test";
    }
}

Error: Property or method "data" is not defined on the instance but referenced during render

When referenced from another method (e.g. console.log(this.data)) undefined is returned.

Decorators error using TypeScript 2.5.2

Latest update causes the following errors to occur on compilation, no errors show in the IDE (vscode)

error TS1241: Unable to resolve signature of method decorator when called as an expression.
  Value of type 'DecoratorFactory<LifecycleName>' has no properties in common with type 'TypedPropertyDescriptor<() => void>'. Did you mean to call it?

@Inject @Prop combination does not work as documented

@Inject @Prop are documented as

// Allow the provided dependency to be overridden by a prop

This does not work, the injected value is always used. This would be useful functionality, the generated members may need to be:

inject: { "field": "__inject_field" }, props: ["field"]

then replace the field prop member (storing it __prop_field) with

get field() {
   if(this.__prop_field !== undefined)  return this.__prop_field;
   return this.__inject_field;
}

This means that Prop/Inject will need to be aware of each other or special handling needs to be added for this to @component.

Methods are not bound to the Vue instance

Methods are not being bound to the Vue instance on callbacks from events:

@Component({
    template: "<button @click="test">click</button>
}) class Test {
   public test() {
     console.log(this); // null on click
   }
}

This appears to be because methods are not being copied into the $options object.

Method $vuety-provide conflicts with existing Vue instance method

Seems this function in newer versions of Vue is picked up as an issue.

In the provide function in bundle.js adding delete v.proto["$vuety-provide"] appears to resolve this issue, although I'm unsure as to why.

v.done(function (data) {
  delete v.proto["$vuety-provide"];
  data.options.provide = function () {
    var _this = this;
    var provide = {};
    Object.keys(provided).forEach(function (k) { return provide[k] = _this[provided[k]]; });
      return provide;
    };
});

Event decorators - On and Emit

On to be used for attaching a handler

//Handle event by name
@On("eventName") handleEvent(arg1: string, ...args) {
  // Handler
}
//Handle event by naming convention
@On() eventName()  { ... }

//Handle event on root element
@On(v => v.$root, "eventName")

Emit used for raising events

@Emit("eventName") raiseEvent(arg1: string, arg2: number) { 
   // Runs before the event is triggered
  return () => { // Runs after the event is triggered }
}
// Emit an event on the parent
@Emit(v => v.$parent) eventName(arg1: string, arg2: number) { }

These will need to be added on the lifecycle events, so #2 should be looked into first, if that isn't possible the lifecycle events will need to be wrapped or injected as mixin

Fails to build with latest webpack

Output paths can no longer be relative:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output.path: The provided value "./dist" is not an absolute path!

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.