Authored by 郭成尧

调用原生APP方法示例

... ... @@ -4,18 +4,29 @@
* @date: 2016/05/09
*/
'use strict';
const _ = require('lodash');
const helpers = global.yoho.helpers;
/**
* 频道选择页
*/
const component = {
index: (req, res, next) => {
/**
* 示例页面
*/
index: (req, res) => {
res.render('index', {
module: 'example',
page: 'home'
});
},
/**
* 调用 APP 原生方法示例
* @param req
* @param res
*/
app: (req, res) => {
res.render('app', {
module: 'example',
page: 'app'
});
}
};
... ...
... ... @@ -13,5 +13,6 @@ const component = require(cRoot);
const router = expressRouter();
router.get('/', component.index); // 首页
router.get('/app', component.app); // 首页
module.exports = router;
... ...
<div id="app">
<app-box></app-box>
</div>
\ No newline at end of file
... ...

2.66 KB | W: | H:

1.24 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/7/22
* Time: 20:20
*/
const Vue = require('yoho-vue');
const lazyload = require('yoho-vue-lazyload');
const appBox = require('example/app-box.vue');
new Vue({
el: '#app',
components: {
appBox
}
});
Vue.use(lazyload);
... ...
<template>
<button @click="yoho.goTap()">跳转 TAP</button>
<button @click="yoho.goLogin()">跳转登录</button>
<button @click="yoho.goShopingCart()">跳转购物车</button>
<button @click="yoho.goAddress()">跳转地址管理列表</button>
<button @click="yoho.goImageBrowser()">跳转图片浏览</button>
<button @click="yoho.goNewPage()">跳转新的 WAP 页面</button>
<button @click="yoho.goPay()">跳转支付页面</button>
</template>
<style>
button {
width: 30%;
height: 60px;
margin: 1%;
}
</style>
<script>
const yoho = require('yoho');
module.exports = {
data() {
return {
yoho
};
}
};
</script>
... ...