WeChat Mini Programs: how to use button to get the custom attribute value of view?

wxml:

<view class="index-hd" data-vid="11111111" data-uid="22222222"></view>
<button class="tijiao"  type="primary" bindtap="bindtap"></button>

js:

bindtap(e){

console.log(e.target.dataset.vid)

  }

you can't get it by clicking on it like this. You need to write data-vid into button to get


view is nested in button


if it is not < view bindtap= "" data-index= "> < button > < / button > < / view >, then use to get the element SelectorQuery.select (string selector)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b31d-2ba71.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b31d-2ba71.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?