vue 打字效果_打字稿装饰器,使Vue更具打字稿感

vue 打字效果

Vue打字稿 (vue-typescript)

Typescript decorators to make vue play nice with typescript.

打字机装饰器,以使vue与打字机配合使用。

安装 (Install)

This package has one single peer-dependancy: Vue (obviously)

该程序包具有单个对等项依赖关系:Vue(显然)

npm install --save vue-typescript

For the best experience you will want to use typings and typings install --save --global dt~vue as some decorators use these typings for input parameters. If you dont want to use them, the typed vue object will be handled as any.

为了获得最佳体验,您将要使用typings install --save --global dt~vuetypings install --save --global dt~vuetypings install --save --global dt~vue因为某些装饰器typings install --save --global dt~vue这些键入用作输入参数。 如果您不想使用它们,则键入的vue对象将被视为any

Alternatively, clone the vue-typescript-seed repo

或者,克隆vue-typescript-seed回购

特征 (Features)

  • @VueComponent - A class decorator that registers the class as a vue component

    @VueComponent-类装饰器,将类注册为vue组件

  • @Prop - A variable decorator that adds a class' variables to the prop object instead of data

    @Prop-变量修饰器,将类的变量添加到prop对象而不是数据

  • @Watch - A variable or function decorator that adds a property to the watch object mapping the desired function as handler

    @Watch-变量或函数修饰器,将属性添加到将所需函数映射为处理程序的watch对象

  • Computed Properties - to define computed properties, simply use the native typescript syntax get and set (see example below)

    计算属性 -要定义计算属性,只需使用本机打字脚本语法getset (请参见下面的示例)

用法 (Usage)

@VueComponent (@VueComponent)

There are 4 ways to call it:

有四种调用方法:

    @VueComponent     @VueComponent(element:string)     @VueComponent(options:ComponentOption)     @VueComponent(element:string, options:ComponentOption)      element - string to use as html tag      options - the same object as the one you would use when calling Vue.component

@VueComponent @VueComponent(element:string) @VueComponent(options:ComponentOption) @VueComponent(element:string, options:ComponentOption)元素-用作html标签选项的字符串-与调用Vue时使用的对象相同。零件

By default, the tag will be the snake-case version of the

你可能感兴趣的:(vue,python,javascript,react,js,ViewUI)