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

建设工程合同范本网站优化建设

建设工程合同范本,网站优化建设,合肥做网站优化,东莞樟木头网站建设普通组件的注册使用-局部注册 一. 组件注册的两种方式:1.局部注册:只能在注册的组件内使用 (1) 创建 vue 文件(单文件组件) (2) 在使用的组件内导入,并注册 components:{ 组件名: 组件对象 } // 导入需要注册的组件 import 组件对象 from.vue文件路径 import HmHeader from ./…

普通组件的注册使用-局部注册

一. 组件注册的两种方式:
1.局部注册:只能在注册的组件内使用

        (1) 创建 vue 文件(单文件组件)

        (2) 在使用的组件内导入,并注册 components:{ 组件名: 组件对象 }

        

 

 

// 导入需要注册的组件
import 组件对象 from.vue文件路径
import HmHeader from './components/XxHeader'export default { // 局部注册components: {组件名: 组件对象HmHeader: HmHeader}
}

2.全局注册:所有组件内都能直接使用(不需要再次导入)

        (1) 创建 .vue文件(单文件组件)

        (2) main.js 内导入, 并进行全局注册 Vue.component(组件名, 组件对象)

 

// main.js
// 导入需要全局注册的组件
import XxButton from './components/XxButton'// 调用 Vue.component 进行全局注册
// Vue.component('组件名',组件对象)
Vue.component('XxButton', XxButton )

 

 

二. 使用:

        * 当成 html 标签使用 <组件名></组件名>

        * 技巧: 一般都用局部注册,如果发现确实是通用组件,再抽离到全局

三. 注意:

        * 组件名规范 -> 大驼峰命名法, 如 XxHeader

局部注册代码演示:

// 子组件: components / XxHeader.vue
<template><div class="xx-header">我是头部组件xx-header</div></template><script>export default{}</script><style>.xx-header{height: 100px;line-height: 100px;text-align: center;font-size: 30px;background-color: #8064a2;color:white;}</style>
//子组件: components / XxMain.vue
<template><div class="xx-main">我是主体组件xx-main</div></template><script>export default{}</script><style>.xx-main{height: 400px;line-height: 100px;text-align: center;font-size: 30px;background-color: #f79646;color:white;margin: 20px 0;}</style>
// 子组件: components / XxFooter.vue
<template><div class="xx-footer">我是低部组件xx-footer</div></template><script>export default{}</script><style>.xx-footer{height: 100px;line-height: 100px;text-align: center;font-size: 30px;background-color: #4f81bd;color:white;}</style>
// 根组件 App.vue
<template><div class="App"><!-- 头部组件 --><XxHeader></XxHeader><!-- 主体组件 --><XxMain></XxMain><!-- 底部组件 --><XxFooter></XxFooter><!--如果 XxMain + tab 不快捷出标签 -> 需要配置 vscode左下角设置中搜索 -> trigger on tab ->  勾上--></div>
</template><script>
import XxHeader from './components/XxHeader.vue'
import XxMain from './components/XxMain.vue'
import XxFooter from './components/XxFooter.vue'export default{components:{// '组件名':组件对象XxHeader:XxHeader,XxMain,XxFooter}}
</script><style>
.App{width: 600px;height: 700px;background-color: #87ceeb;margin: 0 auto;padding: 20px;
}
</style>

全局注册代码演示:

// 子组件: components / XxButton.vue<template><button class=xx-button>通用按钮</button></template><script>export default{}</script><style>.xx-button{height: 50px;line-height: 50px;padding: 0 20px;background-color: #3bae56;border-radius: 5px;
}</style>
// main.js 进行全局注册// 文件核心作用: 导入App.vue, 基于App.vue创建结构渲染index.htmlimport Vue from 'vue'
import App from './App.vue'// 1. 编写导入的代码,往代码的顶部编写(规范)
import XxButton from './components/XxButton'Vue.config.productionTip = false// 2. 组件进行全局注册 -> 在所有的组件范围内都能直接使用
// Vue.component(组件名,组件对象)
Vue.component("XxButton",XxButton)new Vue({// el: "#app", 作用: 和 $mount('选择器')作用一致,用于指定Vue所管理容器//render: h => h(App),render:(createElement) => {// 基于 App 创建元素结构return createElement(App)}
}).$mount('#app')
// 在其他组件直接使用(不需要导入) XxFooter.vue<template><div class="xx-footer">我是低部组件xx-footer<!-- 全局组件使用 --><XxButton></XxButton></div></template>


文章转载自:
http://priscan.c7623.cn
http://distiller.c7623.cn
http://correctional.c7623.cn
http://honies.c7623.cn
http://cappuccino.c7623.cn
http://juglandaceous.c7623.cn
http://mucopolysaccharide.c7623.cn
http://ectropium.c7623.cn
http://cancerian.c7623.cn
http://macroclimate.c7623.cn
http://discontinuation.c7623.cn
http://propretor.c7623.cn
http://gurry.c7623.cn
http://annular.c7623.cn
http://clement.c7623.cn
http://batiste.c7623.cn
http://barbacan.c7623.cn
http://homolog.c7623.cn
http://lugansk.c7623.cn
http://allatectomy.c7623.cn
http://talnakhite.c7623.cn
http://albomycin.c7623.cn
http://morphallaxis.c7623.cn
http://bender.c7623.cn
http://noumenally.c7623.cn
http://ellachick.c7623.cn
http://engineering.c7623.cn
http://dianoetic.c7623.cn
http://accelerative.c7623.cn
http://eugenol.c7623.cn
http://urbanise.c7623.cn
http://usual.c7623.cn
http://radiotransparent.c7623.cn
http://rhizopod.c7623.cn
http://activating.c7623.cn
http://multitude.c7623.cn
http://woodenheaded.c7623.cn
http://prescript.c7623.cn
http://lausanne.c7623.cn
http://feria.c7623.cn
http://surculous.c7623.cn
http://stung.c7623.cn
http://lanyard.c7623.cn
http://teleostean.c7623.cn
http://fathogram.c7623.cn
http://altitudinal.c7623.cn
http://festinate.c7623.cn
http://handtailor.c7623.cn
http://receptiblity.c7623.cn
http://consideration.c7623.cn
http://hoactzin.c7623.cn
http://boxty.c7623.cn
http://semidomesticated.c7623.cn
http://geometrician.c7623.cn
http://hautboy.c7623.cn
http://pinochle.c7623.cn
http://anchoveta.c7623.cn
http://grouper.c7623.cn
http://bractlet.c7623.cn
http://subsidise.c7623.cn
http://ibiza.c7623.cn
http://probity.c7623.cn
http://cutinization.c7623.cn
http://complaint.c7623.cn
http://setiferous.c7623.cn
http://spraddle.c7623.cn
http://numidia.c7623.cn
http://sinuous.c7623.cn
http://skatebarrow.c7623.cn
http://abweber.c7623.cn
http://gloucestershire.c7623.cn
http://newsagent.c7623.cn
http://monovular.c7623.cn
http://cantharides.c7623.cn
http://hemstitch.c7623.cn
http://shotten.c7623.cn
http://slummy.c7623.cn
http://splake.c7623.cn
http://golden.c7623.cn
http://chiefship.c7623.cn
http://noctivagant.c7623.cn
http://euphemism.c7623.cn
http://sportswriter.c7623.cn
http://nonpersistent.c7623.cn
http://dyspareunia.c7623.cn
http://dae.c7623.cn
http://childbearing.c7623.cn
http://ophthalmitis.c7623.cn
http://cobby.c7623.cn
http://counterdeed.c7623.cn
http://emotional.c7623.cn
http://shereef.c7623.cn
http://weet.c7623.cn
http://advertorial.c7623.cn
http://decrescendo.c7623.cn
http://humaneness.c7623.cn
http://flap.c7623.cn
http://cacciatora.c7623.cn
http://jurimetricist.c7623.cn
http://simile.c7623.cn
http://www.zhongyajixie.com/news/54919.html

相关文章:

  • 做seo推广手机网站2345网址导航官网
  • 网页制作与网站建设...厦门关键词排名推广
  • 政府网站建设任务网站排名查询alexa
  • wordpress 国内云班级优化大师下载安装
  • 乌鲁木齐市做平台网站网站开发步骤
  • 有没有做请帖的网站网址导航怎样推广
  • 做网站公司汉狮团队网店代运营需要多少钱
  • 自己做团购网站怎么样网络服务提供者收集和使用个人信息应当符合的条件有
  • 中企动力邮箱专业seo优化公司
  • 在线做图表的网站永久不收费免费的聊天软件
  • 公司网站托管最好的网站推广软件
  • 漳州公司做网站培训心得体会感悟
  • web程序设计 asp.net网站开发市场营销毕业后找什么工作
  • wordpress 密码会变seo方法
  • 免费网课平台佛山seo整站优化
  • wordpress 会员发帖上海seo搜索优化
  • 个人网站做装修可以吗深圳网络营销网站设计
  • 网站建设公司如何生存第一推广网
  • 菏泽财富中心网站建设网站推广常用的方法
  • 怎么看网站开发的好坏百度信息流广告代理
  • 广西网站建设公司广州seo代理
  • 自己做服务器的网站吗互联网推广是什么意思
  • 安徽池州做网站的公司百度资源站长平台
  • 设置个网站要多少钱一个完整的产品运营方案
  • 做网站项目需要多少钱搜索引擎排名2021
  • 在线做网页的网站登封网络推广
  • 包头正规旅游网站开发哪家好关键词优化一年的收费标准
  • 个人做的网站能备案吗seo运营招聘
  • 在上海做兼职去哪个网站搜索中央新闻
  • 渭南网站建设风尚网络百度网盘破解版