Authored by ccbikai

全局拦截链接跳转

... ... @@ -14,3 +14,13 @@
* 1. cookie 操作请使用 yoho-cookie 文档:https://github.com/florian/cookie.js
* 2. 查询字符串读取 请使用 yoho-qs
*/
const $ = require('yoho-jquery');
const interceptClick = require('common/intercept-click');
$(() => {
$('body').on('click', 'a[href]', function() {
// 拦截跳转
interceptClick($(this).attr('href'));
return false;
});
});
... ...
... ... @@ -7,7 +7,6 @@
const qs = require('yoho-qs');
const contentCode = require('content-code');
const bus = require('common/vue-bus');
const interceptClick = require('common/intercept-click');
const tab = require('channel/tab.vue');
const resources = require('component/resources/index.vue');
... ... @@ -27,13 +26,6 @@
bus.$on('contentCode.change', (code) => {
this.contentCode = code;
});
},
ready() {
$('.resources').on('click', 'a', function() {
// 拦截跳转
interceptClick($(this).attr('href'));
return false;
});
}
};
</script>
... ...
... ... @@ -14,8 +14,6 @@
</template>
<script>
const interceptClick = require('common/intercept-click');
module.exports = {
data() {
return {
... ... @@ -28,13 +26,6 @@
}).then((res) => {
this.list = res.data;
});
},
ready() {
$('.sidebar').on('click', 'a', function() {
// 拦截跳转
interceptClick($(this).attr('href'));
return false;
});
}
};
</script>
... ...
... ... @@ -28,7 +28,8 @@ shelljs.ls(path.join(__dirname, 'js/**/*.page.js')).forEach((f) => {
'yoho-vue',
'yoho-vue-lazyload',
'yoho-vue-swipe',
'yoho-vue-infinite-scroll'
'yoho-vue-infinite-scroll',
'./js/index.js' // 全局公有文件
];
});
... ...