当前位置: 首页 > news >正文

建设网站详细流程图阜新网站制作

建设网站详细流程图,阜新网站制作,Wordpress不显示功能,网站文件服务器一、前言 与link类似 在VUE项目中应用typescript#xff0c;我们需要引入一个库vue-property-decorator#xff0c; 其是基于vue-class-component库而来#xff0c;这个库vue官方推出的一个支持使用class方式来开发vue单文件组件的库 主要的功能如下#xff1a; metho… 一、前言 与link类似 在VUE项目中应用typescript我们需要引入一个库vue-property-decorator 其是基于vue-class-component库而来这个库vue官方推出的一个支持使用class方式来开发vue单文件组件的库 主要的功能如下 methods 可以直接声明为类的成员方法计算属性可以被声明为类的属性访问器初始化的 data 可以被声明为类属性data、render 以及所有的 Vue 生命周期钩子可以直接作为类的成员方法所有其他属性需要放在装饰器中 二、使用 vue-property-decorator 主要提供了多个装饰器和一个函数: PropPropSyncModelWatchProvideInjectProvideReactiveInjectReactiveEmitRefComponent (由 vue-class-component 提供)Mixins (由 vue-class-component 提供) Component Component装饰器它注明了此类为一个Vue组件因此即使没有设置选项也不能省略 如果需要定义比如 name、components、filters、directives以及自定义属性就可以在Component装饰器中定义如下 import {Component,Vue} from vue-property-decorator; import {componentA,componentB} from /components;Component({components:{componentA,componentB,},directives: {focus: {// 指令的定义inserted: function (el) {el.focus()}}} }) export default class YourCompoent extends Vue{}computed、data、methods 这里取消了组件的data和methods属性以往data返回对象中的属性、methods中的方法需要直接定义在Class中当做类的属性和方法 Component export default class HelloDecorator extends Vue {count: number 123 // 类属性相当于以前的 dataadd(): number { // 类方法就是以前的方法this.count 1}// 获取计算属性get total(): number {return this.count 1}// 设置计算属性set total(param:number): void {this.count param} }props 组件接收属性的装饰器如下使用 import {Component,Vue,Prop} from vue-property-decorator;Component export default class YourComponent extends Vue {Prop(String)propA:string;Prop([String,Number])propB:string|number;Prop({type: String, // type: [String , Number]default: default value, // 一般为String或Number//如果是对象或数组的话。默认值从一个工厂函数中返回// defatult: () {// return [a,b]// }required: true,validator: (value) {return [InProcess,Settled].indexOf(value) ! -1}})propC:string; }watch 实际就是Vue中的监听器如下 import { Vue, Component, Watch } from vue-property-decoratorComponent export default class YourComponent extends Vue {Watch(child)onChildChanged(val: string, oldVal: string) {}Watch(person, { immediate: true, deep: true })onPersonChanged1(val: Person, oldVal: Person) {}Watch(person)onPersonChanged2(val: Person, oldVal: Person) {} }emit vue-property-decorator 提供的 Emit 装饰器就是代替Vue 中的事件的触发$emit如下 import {Vue, Component, Emit} from vue-property-decorator;Component({})export default class Some extends Vue{mounted(){this.$on(emit-todo, function(n) {console.log(n)})this.emitTodo(world);}Emit()emitTodo(n: string){console.log(hello);}}三 、总结 可以看到上述typescript版本的vue class的语法与平时javascript版本使用起来还是有很大的不同多处用到class与装饰器但实际上本质是一致的只有不断编写才会得心应手
http://www.hkea.cn/news/14351382/

相关文章:

  • 宏信网络网站建设广告设计专业描述
  • 前端如何做双语网站建设银行官网首页网站公告
  • 服装加工厂网站建设方案计划书对电子商务网站建设与维护的总结
  • 济南企业网站推广方法网站挂马教程
  • 外贸企业建站公司摄影网站模板下载
  • 泰安网站开发购买商标
  • 想建设个网站卖东西企业qq
  • 安全的网站建奉化seo页面优化外包
  • 成功营销网站网站优化收费
  • 哪些国家网站无须备案wordpress 七牛非插件
  • 免费的h5制作网站昆山智能网站开发
  • flash asp网站国际贸易网络营销
  • 怎样学做网站素材网
  • 男人直接做的视频网站比较好的装修公司
  • 在百度上怎么做网站wordpress 优秀网站
  • 建设一个国外服务器的网站怎样创建网站赚钱
  • 网站优化和推广百度seo培训公司
  • 网站站点查询免费建站 永久
  • 做网站前端程序员两个网站 一个域名
  • 虚拟空间网站回收池有什么作用国外酷炫网站
  • 哪个网站是可以做书的虚拟资源下载源码wordpress
  • 企业网站静态模板wordpress同步文章插件
  • 制定一份网站界面设计方案商务网站开发需求分析
  • 二手房地产中介网站建设小说搜索风云榜排名
  • 化妆品网站设计思路石家庄做网站的
  • 电子商务网站建设规划的内容邢台做网站费用
  • 0000网站建设如何百度到自己的网站
  • 国外做的比较好看的网站苏州百度运营公司排名
  • 泰安做网站哪家好网站建设工作安排方案
  • thinkphp手机网站制作中国加盟网