<industry-subscription
appId=""
industryType="14"
noUI
ref="handleRef"
/>
原文链接:https://opendocs.alipay.com/pre-open/0a67v1
mounted() {
this.subscriptionRef = this.$refs.handleRef; // 存储自定义组件实例,方便以后调用
try {
const res = await this.subscriptionRef.getIndustrySubscription();
console.log(res, '示例');
if (res.granted) {
// 如果已经订阅过,不应该显示订阅组件
} else {
// 如果没有订阅过,可以显示订阅组件,订阅相关信息可以从 res 中取到,如下:
// res.subscribeTitle 订阅标题文案
// res.profit 订阅副标题文案(利益点)
// res.industryTypeLogo 所订阅行业的 LOGO
}
} catch (e) {
// 接口报错,自行处理异常逻辑
}
},
获取实例跟原生获取的实例不一样
附原生支付宝小程序(图1)、uniapp实例(图2):