<template>
<div class="hello">
<ul>
<li
v-for="(item, index) in type"
@click="handle($event)"
@touchMove='touchMove'
>{{item.main}} --{{index}}</li>
</ul>
<div class="tabc">
<Tabs :text="type" :mmmmmm="msg"></Tabs> //key/value
</div>
</div>
</template> <script>
import Tabs from './tabs';
export default {
name: 'HelloWorld',
components:{
Tabs
},
data (){
return {
type:[
{main:"切换1"},
{main:"切换2"},
{main:"切换3"}
],
msg:"我是父组件的值" //要传入的值
}
},
methods:{
handle($event){
console.log($event.offsetX)
console.log($event.offsetY)
console.log($event.type)
console.log($event)
},
touchMove(ev) {
ev = ev || event;
ev.preventDefault();
// let btnWidth = this.$refs.remove.offsetWidth; //$refs 减少获取dom节点的消耗
// let btnImg = this.$refs.btnImg.offsetWidth;
console.log(ev);
// console.log(btnWidth); }
},
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
background: #ddd;
margin-bottom: 0px;
height: 40px;
line-height: 40px;
}
a {
color: #42b983;
}
</style>

  

<template>
<div class="hehe">
<h4>{{mmmmmm}}</h4>
<ul>
<li v-for="(item,index) in text">{{item.main}}</li>
</ul>
</div>
</template> <script>
export default {
name: 'hehe',
props: {
text:{ //此处为要接收的值 text为接收过来key
type:Array, //key不能乱写
default:''
},
mmmmmm:{ //同上
type:String,
default:'我是默认值'
} },
data () {
return {
hehe:"222"
}
},
methods:{ }
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
ul,li{
list-style: none;
}
ul{
display: flex;
align-items: center;
margin-top: 5px;
} li{
flex: 1;
text-align: center;
line-height: 40px;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
} h4{
text-align: center;
} </style>

  好记性不如破电脑,仅仅记录,怕忘了,不喜勿喷

最新文章

  1. 最新版CKEditor在线编辑器的配置方法
  2. [IIS]IIS扫盲(二)
  3. 揭秘Sql2014新特性-tempdb性能提升
  4. 通过NORFLASH中的uboot烧写uboot到nandFlash
  5. C语言中输入输出函数
  6. CLR via C# 计算限制的异步操作读书笔记
  7. 《深入Java虚拟机学习笔记》- 第3章 安全
  8. Magento How To Display Product Custom Option On list.phtml
  9. ASP.NET之Application、Session和Cookie的差别
  10. Android学习笔记(一)Git相关配置及使用
  11. HTTP 报文格式
  12. 如何优雅的写一个Vue 的弹框
  13. Web前端学习第一天
  14. Linux修改MAC地址方法
  15. VLAN原理
  16. ArgumentException: 已添加了具有相同键的项。
  17. (C++)UrlEncode的标准实现
  18. 雷林鹏分享:Ruby Socket 编程
  19. centos7下Firewall使用详解
  20. arp hook

热门文章

  1. window下 node.js 的安装
  2. 02_电话拨号器intent说明
  3. 微信公众号开发——获取access_token(PHP版)
  4. Python机器学习算法 — 朴素贝叶斯算法(Naive Bayes)
  5. Luogu P2158 [SDOI2008]仪仗队【数学/欧拉函数】by cellur925
  6. 洛谷 P2634 [国家集训队]聪聪可可
  7. Apusic中间件结合MyEclipse进行远程调试记录
  8. Android SQLite(2)如何判断表是否已经存在
  9. NBA15-16赛季半程有感
  10. JavaScript异常处理和事件处理