You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
709 B
26 lines
709 B
module.exports = {
|
|
postTransformNode (el) {
|
|
const attrsMap = el.attrsMap
|
|
if (attrsMap['open-type'] !== 'getPhoneNumber') {
|
|
return
|
|
}
|
|
const getPhoneNumberValue = attrsMap['@getphonenumber'] || attrsMap['v-on:getphonenumber']
|
|
if (!getPhoneNumberValue) {
|
|
return
|
|
}
|
|
|
|
el.attrs.find(attr => attr.name === 'open-type').value = '"getAuthorize"'
|
|
el.attrs.push({
|
|
name: 'scope',
|
|
value: '"phoneNumber"'
|
|
})
|
|
|
|
delete el.events.getphonenumber
|
|
el.events.getAuthorize = {
|
|
value: '$onAliGetAuthorize(\'' + getPhoneNumberValue + '\',$event)'
|
|
}
|
|
el.events.error = {
|
|
value: '$onAliAuthError(\'' + getPhoneNumberValue + '\',$event)'
|
|
}
|
|
}
|
|
}
|
|
|