목차
回复内容:
백엔드 개발 PHP 튜토리얼 javascript - 微信jssdk调用的问题,明明已经已经注入成功了,为何这样

javascript - 微信jssdk调用的问题,明明已经已经注入成功了,为何这样

Jul 06, 2016 pm 01:51 PM
html html5 javascript php

javascript - 微信jssdk调用的问题,明明已经已经注入成功了,为何这样

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

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

<code>public constructor (options?: BodyConfig, page?: JQuery) {

 

        var _self = this;

 

        if (options == null) { return; }

 

        if (options.jsApiList != null) {

 

            options.jsApiList.unshift.apply(wecaht_opt.jsApiList, options.jsApiList);

 

        }

 

        wecaht_opt = $.extend(true, wecaht_opt, options || {});

 

        if (wecaht_opt.appId == null || wecaht_opt.timestamp == null || wecaht_opt.nonceStr == null || wecaht_opt.signature == null) {

 

            console.log('wx.options is null');

            return;

 

        }

 

        wx.config(wecaht_opt);

 

        console.log(wecaht_opt);

 

        wx.ready(function (res) {

 

            console.log('wx is ready');

 

            wx.showOptionMenu();

 

            wx.hideMenuItems({

 

                menuList: [

                    'menuItem:copyUrl',

                    'menuItem:readMode',

                    'menuItem:openWithQQBrowser',

                    'menuItem:openWithSafari',

                    'menuItem:share:QZone',

                    'menuItem:share:qq',

                    'menuItem:share:weiboApp',

                    'menuItem:share:facebook',

                    'menuItem:favorite'

                ] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3

 

            });

 

            var _title = page.data('share-title');

            var _desc  = page.data('share-desc');

            var _link  = page.data('share-link');

            var _img   = page.data('share-img');

 

            var timeline: MyBodyMenuShareTimeline = {

                title: _title,

                link: _link,

                imgUrl: _img,

                success: function () {

                    console.log('已分享');

                },

                cancel: function (res) {

                    console.log('已取消');

                },

                fail: function (res) {

                    console.log(JSON.stringify(res));

                }

            }

 

            var appmessage: MyBodyMenuShareAppMessage = {

                title: _title,

                desc: _desc,

                link: _link,

                imgUrl: _img,

                success: function () {

                    console.log('已分享');

                },

                cancel: function (res) {

                    console.log('已取消');

                },

                fail: function (res) {

                    console.log(JSON.stringify(res));

                }

            }

 

               wx.onMenuShareTimeline(timeline);

            wx.onMenuShareAppMessage(appmessage);

 

            page.trigger('MrWechatReady');

 

        });

 

        wx.error(function (error) {

 

            console.log('wx is error');

 

            page.trigger('MrWechatError');

 

        });

 

    }</code>

로그인 후 복사
로그인 후 복사

javascript - 微信jssdk调用的问题,明明已经已经注入成功了,为何这样

回复内容:

javascript - 微信jssdk调用的问题,明明已经已经注入成功了,为何这样

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

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

<code>public constructor (options?: BodyConfig, page?: JQuery) {

 

        var _self = this;

 

        if (options == null) { return; }

 

        if (options.jsApiList != null) {

 

            options.jsApiList.unshift.apply(wecaht_opt.jsApiList, options.jsApiList);

 

        }

 

        wecaht_opt = $.extend(true, wecaht_opt, options || {});

 

        if (wecaht_opt.appId == null || wecaht_opt.timestamp == null || wecaht_opt.nonceStr == null || wecaht_opt.signature == null) {

 

            console.log('wx.options is null');

            return;

 

        }

 

        wx.config(wecaht_opt);

 

        console.log(wecaht_opt);

 

        wx.ready(function (res) {

 

            console.log('wx is ready');

 

            wx.showOptionMenu();

 

            wx.hideMenuItems({

 

                menuList: [

                    'menuItem:copyUrl',

                    'menuItem:readMode',

                    'menuItem:openWithQQBrowser',

                    'menuItem:openWithSafari',

                    'menuItem:share:QZone',

                    'menuItem:share:qq',

                    'menuItem:share:weiboApp',

                    'menuItem:share:facebook',

                    'menuItem:favorite'

                ] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3

 

            });

 

            var _title = page.data('share-title');

            var _desc  = page.data('share-desc');

            var _link  = page.data('share-link');

            var _img   = page.data('share-img');

 

            var timeline: MyBodyMenuShareTimeline = {

                title: _title,

                link: _link,

                imgUrl: _img,

                success: function () {

                    console.log('已分享');

                },

                cancel: function (res) {

                    console.log('已取消');

                },

                fail: function (res) {

                    console.log(JSON.stringify(res));

                }

            }

 

            var appmessage: MyBodyMenuShareAppMessage = {

                title: _title,

                desc: _desc,

                link: _link,

                imgUrl: _img,

                success: function () {

                    console.log('已分享');

                },

                cancel: function (res) {

                    console.log('已取消');

                },

                fail: function (res) {

                    console.log(JSON.stringify(res));

                }

            }

 

               wx.onMenuShareTimeline(timeline);

            wx.onMenuShareAppMessage(appmessage);

 

            page.trigger('MrWechatReady');

 

        });

 

        wx.error(function (error) {

 

            console.log('wx is error');

 

            page.trigger('MrWechatError');

 

        });

 

    }</code>

로그인 후 복사
로그인 후 복사

javascript - 微信jssdk调用的问题,明明已经已经注入成功了,为何这样

permission denied
该公众号没有权限使用这个JSAPI,
或者是调用的JSAPI没有传入config的jsApiList参数中(部分接口需要认证之后才能使用)

多看文档……

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Ubuntu 및 Debian용 PHP 8.4 설치 및 업그레이드 가이드 Ubuntu 및 Debian용 PHP 8.4 설치 및 업그레이드 가이드 Dec 24, 2024 pm 04:42 PM

Ubuntu 및 Debian용 PHP 8.4 설치 및 업그레이드 가이드

CakePHP 날짜 및 시간 CakePHP 날짜 및 시간 Sep 10, 2024 pm 05:27 PM

CakePHP 날짜 및 시간

CakePHP 파일 업로드 CakePHP 파일 업로드 Sep 10, 2024 pm 05:27 PM

CakePHP 파일 업로드

CakePHP 라우팅 CakePHP 라우팅 Sep 10, 2024 pm 05:25 PM

CakePHP 라우팅

HTML 테이블 레이아웃 HTML 테이블 레이아웃 Sep 04, 2024 pm 04:54 PM

HTML 테이블 레이아웃

CakePHP 프로젝트 구성 CakePHP 프로젝트 구성 Sep 10, 2024 pm 05:25 PM

CakePHP 프로젝트 구성

CakePHP 토론 CakePHP 토론 Sep 10, 2024 pm 05:28 PM

CakePHP 토론

CakePHP 빠른 가이드 CakePHP 빠른 가이드 Sep 10, 2024 pm 05:27 PM

CakePHP 빠른 가이드

See all articles