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

程序员知识网站需要多少钱东莞seo建站优化费用

程序员知识网站需要多少钱,东莞seo建站优化费用,深圳建设网站哪里好,做厨具公司网站组件是什么 vue组件就是一个个独立的小型的ui模块#xff0c;整个大型的系统就是由一个个小型的UI模块拼接而成的 vue组件就是vue实例#xff0c;通过new Vue函数来创建的一个vue实例#xff0c;不同的组件只不过是options的不同#xff0c;我们基本百分之90的开发工作都…组件是什么 vue组件就是一个个独立的小型的ui模块整个大型的系统就是由一个个小型的UI模块拼接而成的 vue组件就是vue实例通过new Vue函数来创建的一个vue实例不同的组件只不过是options的不同我们基本百分之90的开发工作都是围绕options的配置来进行的 三大核心概念 属性、事件、插槽 属性 属性例子 export default {name: PropsDemo,// 不推荐使用这种做法不利于维护// props: [name, type, list, isVisible],// 建议使用下面的做法来声明属性(使用对象的形式声明)props: {name: String,type: {validator: function(type) {// 这个值必须匹配以下字符串中的一个return [success, warning, danger].includes(value);}},list: {type: Array,// 对象或数组默认值必须从一个工厂获取default: () []},isVisible: {type: boolean,default: false},// 不建议使用onChange来命名会和语法冲突onChange: {type: Function,default: () {}}} }属性使用方法 Props.vue文件内容如下 templatedivname: {{ name }}brtype: {{ type }}brlist: {{ list }}brisVisible: {{ isVisible }}brbutton clickhandleClickchange type/button/div /templatescript export default {name: PropsDemo,// 自动挂载属性inheritAttrs: false,props: {name: String,type: {validator: function(value) {return [success, warning, danger].includes(value);}},list: {type: Array,default: () []},isVisible: {type: Boolean,default: false},onChild: {type: Function,default: () {} }},methods: {handleClick() {// 不可以这么做会报错, 因为我们的属性是单向数据流的不允许在子组件内更改父组件传递过来的值// this.type warning;console.log(触发)console.log(子组件的type是)console.log(this.type)this.onChild(123)}} } /scriptApp.vue文件使用如下 divPropsnameHello Vue!:typetype:is-visiblefalse:on-childhandlePropChangetitle属性Democlasstest1:class[test2]:style{ marginTop: 20px }stylemargin-top: 10px;//divscript import Props from ./components/Props.vue;export default {name: App,components: {TodoItem,Props,// Event},data() {return {msg: hello geek!,info: ,list: [],type: success,name: 事件名}},methods: {handleClick() {if (this.info ! ) {this.list.push(this.info)this.info }},handlePropChange(param) {console.log(param)console.log(父组件)if (this.type success) {this.type warning} else {this.type success}console.log(父组件的type)console.log(this.type)},handleEventChange() {}} } /script 子组件中对属性进行了封装全部在Props中当父组件使用时通过:属性名称的方式进行引用和赋值 子组件定义了一个函数的属性onChild在父组件使用这个属性时也是和使用普通组件一样的方式对onChild进行赋值只不过赋的是函数是的函数也是作为参数来存在 此函数可以接收参数是否接收参数接收什么参数取决于子组件对此函数的定义可以看到子组件中有一个 handleClick方法方法内部对onChild进行了调用并传递参数123当父组件的handlePropChange方法在接收函数时也定义了一个参数用来接收(param) handlePropChange(param) {console.log(param)console.log(父组件)if (this.type success) {this.type warning} else {this.type success}console.log(父组件的type)console.log(this.type)}事件 定义 Even.vue文件 templatedivname: {{ name || -- }}brinput :valuename changehandleChangebr/br/div clickhandleDivClickbutton clickhandleClick重制成功/buttonbutton click.stophandleClick重制失败/button/div/div /templatescript export default {name: EventDemo,props: {name: {type: String}},methods: {handleChange(e) {console.log(改变1)this.$emit(change, e.target.value)console.log(改变2)console.log(e.target.value)},handleDivClick() {console.log(清空)this.$emit(change, )},handleClick() {// 无论做什么都会失败// e.stopPropagation();}} } /script父组件引用方法 Event :nameeventName changehandleEventChange/// 导入 import Event from ./components/Event.vue;// 方法定义 handleEventChange(param) {console.log(父组件接收到change事件)if (param?.target?.value) {this.eventName param?.target?.valueconsole.log(param?.target?.value)} else {this.eventName } }子组件定义方法: handleChange通过this.$emit(change, e.target.value)调用change方法传递当前输入框的值作为参数 父组件通过handleEventChange函数进行接收并声明一个参数param通过param中的param?.target?.value来获取传递的参数值 插槽 组件文件夹内新建文件Slot.vue templatedivslot /slot nametitle /slot nameitem v-bind{ value: vue } //div /template script export default {name: SlotDemo } /script父组件引用部分 SlotDemotemplate v-slot:titleptitle slot1/pptitle slot2/p/templatetemplate v-slot:itempropspitem slot-scope {{ props }}/p/template /SlotDemo// js引用 import SlotDemo from ./components/Slot.vue;子组件通过定义nametitle的插槽、nameitem的插槽父组件通过v-slot:title和v-slot:itemprops来引用子组件定义的插槽 总结
http://www.hkea.cn/news/14444031/

相关文章:

  • 如何免费建网站大连做网页工作室
  • 做彩票网站需要什么服务器wordpress点击文字弹窗
  • 教育网站建设计划书wordpress小工具缓存
  • 黄岛区城市建设局网站商务网站设计实训报告
  • 现在还有做系统的网站吗wordpress 仪表盘
  • 网站建设开票属于什么服务网络营销方式的图片
  • 蚌埠网站建设网站linux做网站1G内存够不
  • 手机网站被拦截怎么解除任丘哪里做网站
  • 三明网站开发域名注册网站排名
  • 房产公司网站建设网站建设策划书
  • 邵阳建设网站的公司网站每年多少钱
  • 宁夏网站设计公司公司网站建设全包
  • 物流企业网站建设特色mvc5网站开发用户注册
  • 企业门户网站建设优势建立网站后期需要干嘛
  • 吉林电商网站建设报价什么软件做电影短视频网站
  • 怎么给网站做关键词排名怎么做免费网站
  • 网站在线做照片建筑涂料网站设计
  • 网站的横幅怎么做的基础建设工程
  • 有哪些网站是封面型滑块验证wordpress
  • 嘉兴港区建设局网站网站建设需求调研方法
  • 服务器网站80端口打不开云端视差wordpress企业主题破解版
  • 阿里巴巴建设网站首页四川建设网官网住房和城乡厅
  • 怎么分析网站的外链建设情况摄影师网站制作
  • 网站做漏洞扫描费用网站页面设计与实现
  • 咸阳网站建设方案东莞高埗做网站哪个公司好
  • wordpress网站下载北京seo多少钱
  • 有个人做网站的吗wordpress的xss漏洞
  • 任丘网站开发建设怎么选物联网是什么
  • 网站消耗流量视觉品牌网站建设
  • 新开传奇网站发布网站tp5企业网站开发百度云