| 123456789101112131415161718192021222324252627282930313233343536373839 |
- export default {
- mounted() {
- this.getDeviceType()
- },
- data() {
- return {
- // 设备类型pc,ios,android
- deviceType: 'pc'
- }
- },
- methods: {
- /**
- * 设备判断
- */
- getDeviceType() {
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
- this.deviceType = 'ios';
- } else if (/(Android)/i.test(navigator.userAgent)) { //判断Android
- this.deviceType = 'android';
- } else { //pc
- };
- },
- /**
- * get cookie
- */
- getCookie() {
- const cookie = {};
- if (document && document.cookie) {
- document.cookie.split(/; ?/).forEach(item => {
- if (item) {
- const it = item.split('=');
- cookie[it[0]] = it[1];
- }
- });
- }
- return cookie;
- }
- }
- }
|