1. event.target.dataset.title:
獲取正在被點擊的組件的設置的title屬性
2.event.currentTarget.dataset.title
獲取目標組件設置的title屬性(事件捕獲的組件)
```
--wxml--
<view class="parent" catchtap="click" data-title="parent">
<view class="child" data-title="child">
</view>
</view>
```

```
--js--
click(){
console.log(event.target.dataset.title);
}
```
此時點擊深色區域輸出'child'
點擊淺色區域輸出'parent'
當前點擊的是哪個元素,則輸出哪個event的title屬性,不存在冒泡干擾
```
--js--
click(){
console.log(event.currentTarget.dataset.title);
}
```
因為此時`click`綁定在`parent`上,所以currentTarget就只會是`parent`,所以不管點深色還是淺色區域,都只會輸出'parent'
- 小程序配置
- 1 開始第一個小程序
- 2 navigationBar
- 3 flex彈性布局
- 4 響應式長度單位: rpx
- 5 添加新的頁面
- 6 配置tabBar
- 7 歡迎頁跳轉到有tabBar的頁面
- 小程序語法
- 1. 數據綁定
- 2. 列表渲染
- 3. 條件渲染
- 4. 小程序和vue data讀取方式
- 5. 屬性的數據綁定方式
- 6. bindtap與catchtap
- 7. event.targe和event.currentTarget
- 組件&demo
- 1. scroll-view
- 2. swiper
- 3. 制作一個音樂播放組件
- 4. chooseImage配合緩存創建頭像
- 5. 獲取input表單value(搜索欄實現)
- 6. map
- 7. Form表單提交獲取數據
- 小程序API
- 1. 緩存 wx.setStorageSync
- 2. 選擇圖片 wx.chooseImage
- 3. 加載 wx.showLoading
- 4. 彈出框 wx.showToast
- 5. 分享與獲取用戶信息
- 項目結構類
- 1. 代碼封裝
- 2. wx.request請求數據分離
- 3. 組件
- 1. slot
- 2. 父元素傳遞class到子元素
- 3. 子組件向父組件傳值
- 4. wxml中引用wxs封裝方法