@@ -31,6 +31,7 @@ export interface UserOptions {
3131 vueVersion ?: string
3232 tsVersion ?: string
3333 epVersion ?: string
34+ vuePr ?: string
3435}
3536export type SerializeState = Record < string , string > & {
3637 _o ?: UserOptions
@@ -51,18 +52,27 @@ export const useStore = (initial: Initial) => {
5152 new URLSearchParams ( location . search ) . get ( 'pr' ) ||
5253 saved ?. _o ?. styleSource ?. split ( '-' , 2 ) [ 1 ]
5354 const prUrl = `https://preview-${ pr } -element-plus.surge.sh/bundle/dist`
55+ const vuePr =
56+ new URLSearchParams ( location . search ) . get ( 'vue' ) || saved ?. _o ?. vuePr
57+ const vuePrUrl = `https://esm.sh/pr`
5458
5559 const versions = reactive < Versions > ( {
5660 vue : saved ?. _o ?. vueVersion ?? 'latest' ,
5761 elementPlus : pr ? 'preview' : ( saved ?. _o ?. epVersion ?? 'latest' ) ,
5862 typescript : saved ?. _o ?. tsVersion ?? 'latest' ,
5963 } )
60- const userOptions : UserOptions = pr
61- ? {
62- showHidden : true ,
63- styleSource : `${ prUrl } /index.css` ,
64- }
65- : { }
64+ const userOptions : UserOptions = { }
65+ if ( pr ) {
66+ Object . assign ( userOptions , {
67+ showHidden : true ,
68+ styleSource : `${ prUrl } /index.css` ,
69+ } )
70+ }
71+ if ( vuePr ) {
72+ Object . assign ( userOptions , {
73+ vuePr,
74+ } )
75+ }
6676 Object . assign ( userOptions , {
6777 vueVersion : saved ?. _o ?. vueVersion ,
6878 tsVersion : saved ?. _o ?. tsVersion ,
@@ -80,6 +90,14 @@ export const useStore = (initial: Initial) => {
8090 'element-plus/' : 'unsupported' ,
8191 } ,
8292 } )
93+
94+ if ( vuePr )
95+ importMap = mergeImportMap ( importMap , {
96+ imports : {
97+ vue : `${ vuePrUrl } /vue@${ vuePr } ` ,
98+ '@vue/shared' : `${ vuePrUrl } /@vue/shared@${ vuePr } ` ,
99+ } ,
100+ } )
83101 return importMap
84102 } )
85103
@@ -238,6 +256,7 @@ export const useStore = (initial: Initial) => {
238256 toggleNightly,
239257 serialize,
240258 init,
259+ vuePr,
241260 }
242261 Object . assign ( store , utils )
243262
0 commit comments