รหัสนั้นง่ายมากเพียงเพื่อให้คุณมีความคิด ฉันจะไม่พูดเรื่องไร้สาระมากที่นี่เพียงแค่นำเสนอซอร์สโค้ด:
การคัดลอกรหัสมีดังนี้:
<! doctype html>
<html>
<head>
<title> การสาธิต WeChat JS API </title>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<link rel = "dns-prefetch" href = "http://mmbiz.qpic.cn">
<link rel = "dns-prefetch" href = "http://res.wx.qq.com">
<meta name = "viewport" content = "width = ความกว้างของอุปกรณ์, ความสูง = ความสูงของอุปกรณ์, inital-scale = 1.0;">
<meta name = "apple-mobile-web-app-appable" content = "ใช่">>
<meta name = "apple-mobile-web-app-status-bar-bar-bar" content = "black">
<meta name = "การตรวจจับรูปแบบ" เนื้อหา = "โทรศัพท์ = no">>
<style type = "text/css">
P {
Padding: 5px 10px;
-
</style>
<script type = "text/javascript" src = "weixinapi.js? v = 1"> </script>
</head>
<body>
<ภาษาสคริปต์ = "JavaScript">
-
ฟังก์ชั่น Class1 () {
this.name = "class1";
this.aa = "aaa";
this.shownam = function () {
การแจ้งเตือน (this.name);
-
-
ฟังก์ชั่น Class2 () {
this.name = "class2";
-
var c1 = ใหม่ class1 ();
var c2 = ใหม่ class2 ();
//c1.shownam ();
c1.shownam.call (c2); // การเปลี่ยนแปลงของวัตถุสำหรับวิธีการ
C1.AAA.CALL (C2); // ข้อผิดพลาดสำหรับวิธีการสืบทอดเมธอดเท่านั้นคุณลักษณะไม่รองรับ
-
</script>
</body>
</html>
ที่นี่ฉันแค่แนะนำแนวคิดสำหรับทุกคนเพื่อให้คุณสามารถเล่นกับความคิดเฉพาะของคุณได้อย่างอิสระ