### 页面定义
~~~
<div id="app" v-cloak>
<keep-alive :include="keep_include">
<component v-bind:is="childView"></component>
</keep-alive>
</div>
~~~
### 引入 js
~~~
<script src="/mobile/libs/rap.1.3.1.js?v=<?php echo $_SERVER[ 'SERVER_START_TIME' ] ?>"></script>
~~~
### 配置
~~~
<script>
Rap.config({
debug: true,// 调试模式
app_version: '1.0',//版本号
router_model: 'history',//路由模式 history 和 hash
history_base: 'mobile',//路由是 history 时的路径前缀
keep_include: ['house/house_list', 'minsu/index', 'order/order_list'],//需要 keep-alive的页面
default_page: "minsu/index",// 默认页面 必须要配
filePostfix: 'html',//组件文件的后缀 默认是html
css: [//需要预加载的 css 文件 ,会被按版本号缓存
'/mobile/libs/mint.min.css',
'/mobile/libs/swiper.min.css',
'/mobile/global.css'
],
script: [//需要预加载的 script 文件 ,会被按版本号缓存
"/mobile/libs/moment.js",
"/mobile/libs/libs.min.js",
'/mobile/libs/base64.min.js',
"/mobile/global.js" //入口文件
]
})
</script>
~~~
### global.js
~~~
Rap.define('/global.js', [], function (util) {
//这边写你自己的的逻辑
Rap.ready(function () {
return Rap.loadMod([
'comp/btm_brand'
]);
}).then(function () {
window.App = Rap.app({
el: '#app',
data: function () {
return {};
},
created: function () {
},
mounted: function () {
}
});
}).then(function () {
}).catch(function (e) {
});
});
~~~