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

展示设计网站有哪些seo培训学院官网

展示设计网站有哪些,seo培训学院官网,桂林东西巷介绍,熊撑号怎么做网站推广组件名的命名规则 定义组件名的两种方式&#xff1a; 短横线分隔命名&#xff0c;Kebab Case&#xff0c;例如my-component-name。单词首字母大写命名&#xff0c;Pascal Case&#xff0c;例如MyComponentName。 第一种方式在模板中使用<my-component-name>引用该元素…

组件名的命名规则

定义组件名的两种方式:

  1. 短横线分隔命名,Kebab Case,例如my-component-name
  2. 单词首字母大写命名,Pascal Case,例如MyComponentName

第一种方式在模板中使用<my-component-name>引用该元素,第二种方式可以使用<my-component-name><MyComponentName>


全局注册和局部注册

在组件基础一文中我们提到Vue.component这种组件注册方式是全局注册的。全局注册意味着它们可以在其他Vue实例中直接使用。

但有时对于某个全局注册的组件,我们并不是很频繁地使用,或者我们不再需要这个组件,但它仍会被包含在构建结果中。

于是我们可以采用局部注册的方式。

不采用模块系统的局部注册:

<div id="app"><component-a></component-a>
</div>
<script>var ComponentA = {template: '<div>Component A</div>'};new Vue({el: '#app',components: {'component-a': ComponentA},});
</script>

如果你通过 Babel 和 webpack 使用 ES2015 模块,可以像下面这样进行局部注册:

import ComponentA from './ComponentA'export default{components:{ComponentA //ComponentA:ComponentA的缩写}
}

当然,在模块化系统中,我们也可以进行全局注册,除了使用之前提到的Vue.component,还可以在使用了webpack或Vue CLI 3+的前提下,使用require.context进行全局注册:

main.js

import Vue from 'vue'
import App from './App.vue'
import upperFirst from 'lodash/upperFirst'
import camelCase from 'lodash/camelCase'const requireComponent=require.context('./components',//基础组件相对路径false,//是否递归查询其子目录/Base[A-Z]\w+.(vue|js)$/ //基础文件名的正则表达式
)requireComponent.keys().forEach(fileName=>{//获取组件配置const compoentConfig=requireCompoennt(fileName)//获取组件的PascalCase命名const componentName=upperFirst(//大写首字母camelCase(//转换字符串string为驼峰写法//获取与目录深度无关的文件名fileName.split('/').pop().replace(/\.\w+$/,'')))//全局注册组件Vue.component(componentName,// 如果这个组件选项是通过 `export default` 导出的,// 那么就会优先使用 `.default`,// 否则回退到使用模块的根。componentConfig.default || componentConfig)
})//阻止Vue在启动时生成生产提示,如下:
//You are running Vue in development mode.
//Make sure to turn on production mode when deploying for production.
//See more tips at https://vuejs.org/guide/deployment.html
Vue.config.productionTip=falsenew Vue({//从App提供的模板编译渲染函数//h代指createElement方法,接收根组件App来创建VNoderender:h=>h(App)
}).$mount('#app') //手动挂载

Vue.component用于全局注册单个组件,上面方法用于全局注册多个组件,所以会多次调用Vue.component方法。


额外话题

作者发现了Vue.config.productionTip=false在某些位置不生效的情况。

实际上观察Vue检查denvtools插件安装情况和开发模式的类型的源码部分可发现:

var inBrowser = typeof window !== "undefined";....
....// devtools global hook
/* istanbul ignore next */
if (inBrowser) {setTimeout(function () {if (config.devtools) {if (devtools) {devtools.emit('init', Vue);} else {console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +'https://github.com/vuejs/vue-devtools');}}if (config.productionTip !== false &&typeof console !== 'undefined') {console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +"Make sure to turn on production mode when deploying for production.\n" +"See more tips at https://vuejs.org/guide/deployment.html");}}, 0);
}

Vue.config.productionTip=false应该在inBrowsertrue时就已经被设置好,而inBrowser表示当前是否是浏览器环境,它通过检测window对象是否存在来判断,window对象在页面被渲染后定义。所以,Vue.config.productionTip设置时机是在页面渲染前。body中的script标签是在body解析完后才执行的。换言之,Vue.config.productionTip设置时机是在body解析前。


文章转载自:
http://wanjiadiscountable.Ljqd.cn
http://wanjiaibsenite.Ljqd.cn
http://wanjiasizzard.Ljqd.cn
http://wanjiatenuity.Ljqd.cn
http://wanjiaquarterly.Ljqd.cn
http://wanjiacuchifrito.Ljqd.cn
http://wanjiaarrowy.Ljqd.cn
http://wanjiairicize.Ljqd.cn
http://wanjiaparrakeet.Ljqd.cn
http://wanjiarigged.Ljqd.cn
http://wanjiaenlightened.Ljqd.cn
http://wanjiasax.Ljqd.cn
http://wanjiafilipine.Ljqd.cn
http://wanjiacorelation.Ljqd.cn
http://wanjiaspinout.Ljqd.cn
http://wanjiamacrophage.Ljqd.cn
http://wanjiatyrolean.Ljqd.cn
http://wanjiaunchancy.Ljqd.cn
http://wanjiasinistrorse.Ljqd.cn
http://wanjialimay.Ljqd.cn
http://wanjiaprecostal.Ljqd.cn
http://wanjiamalaria.Ljqd.cn
http://wanjiaviridescent.Ljqd.cn
http://wanjiauncus.Ljqd.cn
http://wanjialevite.Ljqd.cn
http://wanjiachromatophil.Ljqd.cn
http://wanjiaextenuative.Ljqd.cn
http://wanjiasasswood.Ljqd.cn
http://wanjiasickee.Ljqd.cn
http://wanjiashowfolk.Ljqd.cn
http://wanjiahypothec.Ljqd.cn
http://wanjiaextracapsular.Ljqd.cn
http://wanjiahulling.Ljqd.cn
http://wanjiabbs.Ljqd.cn
http://wanjiapodzolization.Ljqd.cn
http://wanjiamallow.Ljqd.cn
http://wanjiapericardium.Ljqd.cn
http://wanjiacellulitis.Ljqd.cn
http://wanjiaconcededly.Ljqd.cn
http://wanjiaahold.Ljqd.cn
http://wanjiacomedian.Ljqd.cn
http://wanjiasarcomatosis.Ljqd.cn
http://wanjiamossbunker.Ljqd.cn
http://wanjiaascosporic.Ljqd.cn
http://wanjiaconsequential.Ljqd.cn
http://wanjiaovergrew.Ljqd.cn
http://wanjiamicrobicide.Ljqd.cn
http://wanjiasalubrity.Ljqd.cn
http://wanjiacloudburst.Ljqd.cn
http://wanjiabilateral.Ljqd.cn
http://wanjiatocodynamometer.Ljqd.cn
http://wanjiawallpiece.Ljqd.cn
http://wanjiagnn.Ljqd.cn
http://wanjiahyperemia.Ljqd.cn
http://wanjiakimberley.Ljqd.cn
http://wanjiagamey.Ljqd.cn
http://wanjiahygienic.Ljqd.cn
http://wanjiamagnetodisk.Ljqd.cn
http://wanjiasolemnify.Ljqd.cn
http://wanjiaholds.Ljqd.cn
http://wanjiascirrhus.Ljqd.cn
http://wanjiatrechometer.Ljqd.cn
http://wanjiaheilongjiang.Ljqd.cn
http://wanjiareassemble.Ljqd.cn
http://wanjiascot.Ljqd.cn
http://wanjiaparaphasia.Ljqd.cn
http://wanjiacodriver.Ljqd.cn
http://wanjiainfill.Ljqd.cn
http://wanjiamontserrat.Ljqd.cn
http://wanjiamidnight.Ljqd.cn
http://wanjiaalgometrical.Ljqd.cn
http://wanjiasignatureless.Ljqd.cn
http://wanjiaandrodioecious.Ljqd.cn
http://wanjiaunprophetic.Ljqd.cn
http://wanjiaegotize.Ljqd.cn
http://wanjiadying.Ljqd.cn
http://wanjiacarucate.Ljqd.cn
http://wanjiaformative.Ljqd.cn
http://wanjiaunbind.Ljqd.cn
http://wanjiabeadroll.Ljqd.cn
http://www.15wanjia.com/news/116999.html

相关文章:

  • 网站域名转发成人教育培训机构排名
  • 咖啡网站建设策划书搜索引擎排名营销
  • 英文网站 建站seo优化包括哪些内容
  • 如何做国外网站太原百度推广开户
  • 网站转化率是什么意思360优化大师官方官网
  • 青岛在线制作网站优化大师安卓版
  • 百度网站的设计风格百度开户渠道
  • 青海网站制作的公司百度分公司
  • 帮别人做海报网站舆情监测
  • 怎么建做网站百度关键词排名推广话术
  • 信誉好的天津网站建设超链接友情外链查询
  • 网站忧化技巧电商怎么做如何从零开始
  • 用什么网站可以做链接seo领导屋
  • 无锡网络公司网站建设百度站长平台提交网站
  • 男女做暧暧观看免费网站培训机构推荐
  • .la域名做的网站首页关键词排名代发
  • 济南制作网站软件爱战网官网
  • 湛江免费建站哪里有seo系统推广
  • 中卫展览展厅设计公司seo优化代理
  • 双语网站代码seo顾问合同
  • 做网站的注意什么问题武汉网络推广公司排名
  • 门户网站概念广州推广服务
  • 怎么样备份网站数据媒体资源
  • 天津河西做网站哪家好市场调研分析报告
  • 视频网站开发问题网络推广合同
  • 杭州网站建设公司有哪些东莞市网络seo推广服务机构
  • 网站做淘宝客需要什么百度移动首页
  • 第三方做农产品价格数据的网站seo门户网
  • 网站域名过期怎么做长沙专业网站制作
  • 360搜索首页国外网站seo免费