發現左一個可以玩殘你嘅咪記大bug

發現左一個可以玩殘你嘅咪記大bug

2018/06/18 Office 365 SharePoint 0

發現左一個可以玩殘你嘅咪記大bug,如果你寫sharepoint兼用typescript但係又想用jquery, 你好可能會用:

import * as $ from ‘jquery’;
如果嗰畫面得一個webpart,甘你會無事,如果有多個webpart(見下圖),你reload幾次就會撞到有一次某幾個webpart無哂野,因為jquery撞左,網上有啲友話係config.json個externals加返jquery呢一招我試過唔得。但我撞到有一招係work嘅:
SPComponentLoader.loadScript('https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js', { globalExportsName: 'jQuery' }).then((jQuery: any): void => {
			var $ = jQuery;
			SPComponentLoader.loadScript('https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js', {}).then((): void => { }).then((): void => {

				$(".owl-carousel").owlCarousel();
			});
		});

read count : 2

Leave a Reply

Your email address will not be published. Required fields are marked *