Skip to content

Commit 547b994

Browse files
committed
feat(vue): if the platform is not supported, no global property will be generated
1 parent bf5bfb9 commit 547b994

2 files changed

Lines changed: 22 additions & 18 deletions

File tree

packages/vue/src/variants/vitepress.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,17 @@ function registerProvider<P extends Platform>({
3131

3232
// Add a global property to Vue instance
3333
const property = getGlobalProperty(platform)
34-
const version = getMajorVersion(app)
35-
switch (version) {
36-
case 2: {
37-
app.prototype[property] = analytics
38-
break
39-
}
40-
case 3: {
41-
app.config.globalProperties[property] = analytics
42-
break
34+
if (property) {
35+
const version = getMajorVersion(app)
36+
switch (version) {
37+
case 2: {
38+
app.prototype[property] = analytics
39+
break
40+
}
41+
case 3: {
42+
app.config.globalProperties[property] = analytics
43+
break
44+
}
4345
}
4446
}
4547
}

packages/vue/src/variants/vue.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ function registerProvider<P extends Platform>({
3232

3333
// Add a global property to Vue instance
3434
const property = getGlobalProperty(platform)
35-
const version = getMajorVersion(app)
36-
switch (version) {
37-
case 2: {
38-
app.prototype[property] = analytics
39-
break
40-
}
41-
case 3: {
42-
app.config.globalProperties[property] = analytics
43-
break
35+
if (property) {
36+
const version = getMajorVersion(app)
37+
switch (version) {
38+
case 2: {
39+
app.prototype[property] = analytics
40+
break
41+
}
42+
case 3: {
43+
app.config.globalProperties[property] = analytics
44+
break
45+
}
4446
}
4547
}
4648

0 commit comments

Comments
 (0)