5. 完整示例代码

    second.html

    1. <head>
    2. <meta charset="utf-8">
    3. <title>My Second MIP Page</title>
    4. <meta name="apple-touch-fullscreen" content="yes">
    5. <meta name="apple-mobile-web-app-capable" content="yes">
    6. <meta name="format-detection" content="telephone=no">
    7. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    8. <link rel="stylesheet" href="https://c.mipcdn.com/static/v2/mip.css">
    9. <style mip-custom>
    10. h2 {
    11. text-align: center;
    12. margin: 10px auto;
    13. }
    14. .main-image {
    15. margin: 10px auto;
    16. display: block;
    17. }
    18. p,h3 {
    19. margin: 10px;
    20. }
    21. </style>
    22. <body>
    23. <mip-img src="https://www.mipengine.org/static/img/mip_logo_3b722d7.png" width="213" height="112" class="main-image"></mip-img>
    24. <p>MIP 为所有组件提供了一些常用的样式,避免开发者在编写组件时重复实现。这部分样式会在以后的迭代中逐步完善,敬请开发者们关注。</p>
    25. <h3>一像素边框</h3>
    26. <p>针对移动端浏览器在高清屏幕显示中最常见的“一像素边框”问题,MIP 给出了通用的解决方案。开发者只需要引入固定的类名即可绘制出真实的一像素边框。</p>
    27. <mip-shell>
    28. <script type="application/json">
    29. {
    30. "routes": [
    31. {
    32. "pattern": "/use-shell.html",
    33. "meta": {
    34. "header": {
    35. "show": true,
    36. "title": "我的首页",
    37. "logo": "https://gss0.bdstatic.com/5bd1bjqh_Q23odCf/static/wiseindex/img/favicon64.ico",
    38. "buttonGroup": [
    39. {
    40. "name": "subscribe",
    41. "text": "关注"
    42. "name": "chat",
    43. "text": "发消息"
    44. }
    45. ]
    46. },
    47. "view": {
    48. "isIndex": true
    49. }
    50. }
    51. },
    52. {
    53. "pattern": "*",
    54. "meta": {
    55. "header": {
    56. "show": true,
    57. "title": "其他页面"
    58. }
    59. }
    60. }
    61. ]
    62. }
    63. </script>
    64. </mip-shell>
    65. <script src="https://c.mipcdn.com/static/v2/mip.js"></script>
    66. </html>