首页 > 其他分享 >2.13

2.13

时间:2024-02-23 20:55:51浏览次数:20  
标签:vue color height components import 2.13 HmButton

今天学vue的组件化开发,组件的局部注册和全局注册

现在写页面就可以像拼图一样,将一个个组件拼起来了,方便快捷了不少.

今日代码

<template>
    <div class="hm-Footer">
      芝士Footer <hm-button>按钮</hm-button>
    </div>
  </template>
  
  <script>
import HmButton from './HmButton.vue'
  export default {
  components: { HmButton },
  
  }
  </script>
  
  <style>
  .hm-Footer{
      height: 100px;
      text-align: center;
      font-size: 30px;
      background-color: #4132c3;
      color: white;
      
  }
  </style>
<template>
  <div class="hm-main">
    芝士main  
  </div>
</template>

<script>
export default {

}
</script>

<style>
.hm-main{
    height: 400px;
    
    text-align: center;
    font-size: 30px;
    background-color: #a58e28;
    color: white;
    margin: 20px 0;
}
</style>
<template>
  <div class="hm-header">
    芝士header 
  </div>
</template>

<script>
export default {

}
</script>

<style>
.hm-header{
    height: 100px;

    text-align: center;
    font-size: 10px;
    background-color: #8064a2;
    color: white;
}
</style>
<template>
  <button class="hm-button">通用按钮</button>
</template>

<script>
export default {
    
}
</script>

<style>
    .hm-button{
        height: 50px;
        line-height: 50px;
        padding: 0 20px;
        background-color: yellow;
        border-radius: 5px;
        vertical-align: middle;
    }
</style>
<template>
  <div class="App">
    <HmHeader></HmHeader>
    <HmMain></HmMain>
    <HmFooter></HmFooter>
  </div>
</template>

<script>
import HmHeader from './components/HmHeader.vue';
import HmFooter from './components/HmFooter';
import HmMain from './components/HmMain.vue';
export default {
  components:{
    HmHeader,
    HmMain,
    HmFooter,
  }
}
</script>

<style>
.App{
  width: 600px;
  height: 600px;
  background-color: #87ceeb;
  margin: 0 auto;
  padding: 20px;

}
</style>
import Vue from 'vue'
import App from './App.vue'

//导入需要全局注册的组件
import HmButton from './components/HmButton'

//调用Vue.component 进行全局注册
//Vue.component('组件名',组件对象)
Vue.component('HmButton',HmButton)

new Vue({
  render: h => h(App),
}).$mount('#app')

 

标签:vue,color,height,components,import,2.13,HmButton
From: https://www.cnblogs.com/daniel350-wang/p/18030352

相关文章

  • 2024.2.13 LGJ Round
    A一个圆上有\(2n\)个点,你需要选出\(n\)个点对连一条线段,其中一些点对已经被选。问所有点对方案中,联通块个数的和,联通的含义是线段相交,那么两条线段的端点都互相可达。\(n\le300\)。线段相交,把圆放到序列上就是区间相交然而不包含。我们拆贡献,计算每个区间\([l,r]\)的......
  • 闲话2.13
    哎嘿,我复活了!昨天到的西安,旅游体验很棒啊......
  • 2.13
           ......
  • 【ubantu22.10】安装部署timescaledbv2.13.0及postgresql v14.10
    一、安装部署postgresql-timescaledbaptinstallgnupgpostgresql-commonapt-transport-httpslsb-releasewget二、运行postgresql存储库设置脚本/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh三、添加timescaledb第三方存储库echo"debhttps://packageclo......
  • 12.13
    《程序员修炼之道》第七章在项目开始之前的阅读笔记这一章讨论了在项目开始之前要面临的一些问题和挑战,以及如何应对和解决它们。作者提出了以下几个主题:不要搜集需求,而要挖掘需求。需求是用户想要解决的问题,而不是用户目前做事情的方式。要站在用户的角度,了解他们的真正需求和......
  • 12.13
    UserMapperpackagecom.example.mapper;importcom.example.pojo.Agent;importcom.example.pojo.Customer;importcom.example.pojo.House;importcom.example.pojo.Users;importorg.apache.ibatis.annotations.*;importjava.util.List;@Mapperpublicinterf......
  • 12.13
    UserMapperpackagecom.example.mapper;importcom.example.pojo.Agent;importcom.example.pojo.Customer;importcom.example.pojo.House;importcom.example.pojo.Users;importorg.apache.ibatis.annotations.*;importjava.util.List;@Mapperpublicinterfa......
  • 12.13日
    早上五点多一点就醒来了,在床上坐着,闭目,再睁眼就是六点了。舍友们都还在睡梦,我静静穿好衣服,拿好洗漱用品,洗漱完简单收拾了一下,拿上早上上课用的书笔就离开了。一晚上的翻来覆去,身体虚弱,六点半的食堂也没什么吃的,我就只吃了两根油条,喝了一杯奶。今天的雪更大了,吃完早餐下台阶的时候......
  • 12.13每日总结
    packagetuxiang;importokhttp3.*;importorg.json.JSONObject;importjavax.imageio.ImageIO;importjavax.swing.*;importjava.awt.*;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.image.BufferedImage;importja......
  • 12.13 闲话
    昨天\(12.12\)今年是西安事变\(87\)周年所以\(\mathrm{CCF}\)送给\(\mathrm{HE}\)省队一个\(\mathrm{HE}\)事变,现在看起来大家都已经快似了(悲)今天打了个Hash水题???企鹅DescriptionPenguinQQ是中国最大、最具影响力的SNS(SocialNetworkingServices)网站,以实名制为基础,为用户......