vivo-ui
Version:
vivo ui component lib for vue
23 lines (18 loc) • 588 B
JavaScript
import { data } from '../../mixins/type';
var resize = void 0;
function index (type, boundary) {
// 设置组件类型
boundary = boundary || 768;
resize && window.removeEventListener('resize', resize); // 移除之前设置的监听器
switch (type) {
case 'responsive':
data.page.type = window.innerWidth < boundary ? 'wap' : 'pc';
window.addEventListener('resize', resize = function resize() {
data.page.type = window.innerWidth < boundary ? 'wap' : 'pc';
});
break;
default:
data.page.type = type;
}
}
export default index;