正在显示
5 个修改的文件
包含
4 行增加
和
95 行删除
hybrid/html/local.html
已删除
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | - <head> | ||
4 | - <meta charset="utf-8" /> | ||
5 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
6 | - <title>本地网页</title> | ||
7 | - <style type="text/css"> | ||
8 | - .btn { | ||
9 | - display: block; | ||
10 | - margin: 20px auto; | ||
11 | - padding: 5px; | ||
12 | - background-color: #007aff; | ||
13 | - border: 0; | ||
14 | - color: #ffffff; | ||
15 | - height: 40px; | ||
16 | - width: 200px; | ||
17 | - } | ||
18 | - | ||
19 | - .btn-red { | ||
20 | - background-color: #dd524d; | ||
21 | - } | ||
22 | - | ||
23 | - .btn-yellow { | ||
24 | - background-color: #f0ad4e; | ||
25 | - } | ||
26 | - | ||
27 | - .desc { | ||
28 | - padding: 10px; | ||
29 | - color: #999999; | ||
30 | - } | ||
31 | - </style> | ||
32 | - </head> | ||
33 | - <body> | ||
34 | - <p class="desc">web-view 组件加载本地 html 示例,仅在 App 环境下生效。点击下列按钮,跳转至其它页面。</p> | ||
35 | - <div class="btn-list"> | ||
36 | - <button class="btn" type="button" data-action="navigateTo">navigateTo</button> | ||
37 | - <button class="btn" type="button" data-action="redirectTo">redirectTo</button> | ||
38 | - <button class="btn" type="button" data-action="navigateBack">navigateBack</button> | ||
39 | - <button class="btn" type="button" data-action="reLaunch">reLaunch</button> | ||
40 | - <button class="btn" type="button" data-action="switchTab">switchTab</button> | ||
41 | - </div> | ||
42 | - <p class="desc">网页向应用发送消息。注意:小程序端应用会在此页面后退时接收到消息。</p> | ||
43 | - <div class="btn-list"> | ||
44 | - <button class="btn btn-red" type="button" id="postMessage">postMessage</button> | ||
45 | - </div> | ||
46 | - <!-- uni 的 SDK --> | ||
47 | - <script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.1/index.js"></script> | ||
48 | - <script type="text/javascript"> | ||
49 | - document.addEventListener('UniAppJSBridgeReady', function() { | ||
50 | - document.querySelector('.btn-list').addEventListener('click', function(evt) { | ||
51 | - var target = evt.target; | ||
52 | - if (target.tagName === 'BUTTON') { | ||
53 | - var action = target.getAttribute('data-action'); | ||
54 | - switch (action) { | ||
55 | - case 'switchTab': | ||
56 | - uni.switchTab({ | ||
57 | - url: '/pages/tabBar/API/API' | ||
58 | - }); | ||
59 | - break; | ||
60 | - case 'reLaunch': | ||
61 | - uni.reLaunch({ | ||
62 | - url: '/pages/tabBar/API/API' | ||
63 | - }); | ||
64 | - break; | ||
65 | - case 'navigateBack': | ||
66 | - uni.navigateBack({ | ||
67 | - delta: 1 | ||
68 | - }); | ||
69 | - break; | ||
70 | - default: | ||
71 | - uni[action]({ | ||
72 | - url: '/pages/component/button/button' | ||
73 | - }); | ||
74 | - break; | ||
75 | - } | ||
76 | - } | ||
77 | - }); | ||
78 | - document.querySelector("#postMessage").addEventListener('click', function() { | ||
79 | - uni.postMessage({ | ||
80 | - data: { | ||
81 | - action: 'message' | ||
82 | - } | ||
83 | - }); | ||
84 | - }) | ||
85 | - }); | ||
86 | - </script> | ||
87 | - </body> | ||
88 | -</html> |
1 | { | 1 | { |
2 | - "name" : "市场监管", | 2 | + "name" : "设备乐", |
3 | "appid" : "__UNI__64CFE40", | 3 | "appid" : "__UNI__64CFE40", |
4 | - "description" : "多平台快速开发的UI框架", | 4 | + "description" : "", |
5 | "versionName" : "1.0.0", | 5 | "versionName" : "1.0.0", |
6 | "versionCode" : 1, | 6 | "versionCode" : 1, |
7 | "transformPx" : false, | 7 | "transformPx" : false, |
-
请 注册 或 登录 后发表评论