1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import Swiper from 'swiper/bundle'
- import gsap from 'gsap'
- import Common from '../common/js/Common'
- import {
- isMobile
- } from '../common/js/utils'
-
- export default class App {
- constructor() {
- let common = new Common(document.querySelector('.main'),4) //导航菜单高亮,0是首页,后面的按顺序添加
- this.isMobile = isMobile()
- // this.tabChange()
- // 图片及视频资源懒加载。防止阻塞js执行
- let lazyDoms = document.querySelectorAll(".lazy");
- lazyDoms.forEach((item) => {
- console.log(item, 'item---1')
- if (item.nodeName == "PICTURE") {
- item.children[0].setAttribute("srcset", item.children[0].dataset.srcset);
- item.children[1].setAttribute("src", item.children[1].dataset.src);
- }
- if (item.nodeName == "IMG") {
- item.setAttribute("src", item.dataset.src);
- }
- if (item.nodeName == "VIDEO") {
- console.log(item, 'item---2')
- item.setAttribute("src", item.dataset.src);
- // item.load();
- }
- });
- vx()
- function vx(){
- console.log('vx',wx)
- wx.config({
- debug: false, // 开启调试模式
- appId: 'YOUR_APP_ID', // 公众号的唯一标识
- timestamp: 176565448486313, // 生成签名的时间戳
- nonceStr: 'NONCESTR', // 生成签名的随机串
- signature: 'SIGNATURE', // 签名,见附录1
- jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 需要使用的 JS 接口列表
- });
-
- wx.ready(function () {
- // 分享到朋友圈
- wx.onMenuShareTimeline({
- title: '分享标题', // 分享标题
- link: 'https://example.com', // 分享链接
- imgUrl: 'https://example.com/image.jpg', // 分享图标
- success: function () {
- // 用户确认分享后执行的回调函数
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- const shareWx = document.querySelector('.shareWx');
- console.log(shareWx)
- shareWx.addEventListener('click',function(){
- // 分享给朋友
- wx.onMenuShareAppMessage({
- title: '分享标题', // 分享标题
- desc: '分享描述', // 分享描述
- type: 'link', // 分享类型,music、video或link,不填默认为link
- success: function () {
- // 用户确认分享后执行的回调函数
-
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- })
-
- });
- }
- }
-
-
-
-
- }
|