app-box.vue
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<template>
<div>
<button class="button" @click='yoho.goTap({"index":2})'>TAP</button>
<button class="button" @click="yoho.goLogin()">登录</button>
<button class="button" @click="yoho.goLogout()">退出登录</button>
<button class="button" @click='yoho.goShopingKey({"shoppingkey":"123456789"})'>设置ShopingKey</button>
<button class="button" @click="yoho.goShopingCart()">跳转购物车</button>
<button class="button" @click='yoho.goAddress({"type":"1"}, addressCallback)'>地址选择页面</button>
<button class="button" @click='yoho.goAddress({"type":"2"}, addressCallback)'>地址管理页面</button>
<button class="button" @click='yoho.goImageBrowser({"images":["http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg"], "index": "1"})'>图片浏览</button>
<button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button>
<button class="button" @click="yoho.goPay()">支付</button>
<button class="button" @click="yoho.goBack()">返回</button>
<button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com/example/app"})'>分享</button>
<button class="button" @click='yoho.goSearch()'>搜索</button>
<button class="button" @click='yoho.goSetting()'>设置</button>
<button class="button" @click='yoho.goSetAvatar()'>设置头像</button>
</div>
</template>
<style>
body {
word-break: break-all;
}
button {
margin-bottom: 20px;
}
</style>
<script>
import yoho from 'yoho';
import modal from 'common/modal';
import share from 'common/share';
export default {
data() {
return {
yoho
};
},
created() {
yoho.addNativeMethod('headerRightTopBtn', function(data) {
modal.alert('app 调用 H5 成功!');
if (data) {
modal.alert('传递的信息是:' + data);
}
});
share({
title: '标题',
link: location.href,
desc: '我在BLK发现了一个不错的品牌,赶快来看看吧!',
imgUrl: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg'
});
},
methods: {
addressCallback(info) {
alert(JSON.stringify(info)); // eslint-disable-line
}
}
};
</script>