Skip to content

Commit a6e285f

Browse files
committed
small template updates
introducing Vue CLI 3 UI
1 parent 750115b commit a6e285f

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

Diff for: generator/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ const renderDirectoryStructure = (module.exports.renderDirectoryStructure = asyn
821821
) => {
822822
try {
823823
const files = new Array();
824-
const baseDir = await extractCallDir()
824+
const baseDir = await extractCallDir();
825825
const _files = await getAllFilesInDirStructure(srcPathPrefix, baseDir);
826826

827827
for (const rawPath of _files) {
@@ -902,7 +902,6 @@ const getAllFilesInDirStructure = (module.exports.replaceInFile = async (srcPath
902902
// utility function used to remove sections of strings from files
903903
const replaceInFile = (module.exports.replaceInFile = async (options) => {
904904
try {
905-
//const changes =
906905
await replace(options);
907906
} catch (error) {
908907
console.error('Error occurred:', error);

Diff for: generator/templates/simple/src/App.vue

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
</nav>
1111
<div class="w-container">
1212
<router-link tag="button" class="w-button" id="homeButton" to="/">Home</router-link>
13-
<router-link tag="button" class="w-button" id="aboutButton" to="/about">About</router-link>
13+
<!-- alternate way to route manually and use the same method as native -->
14+
<button class="w-button" id="aboutButton" v-on:click="goToAboutPage">About</button>
1415
<router-view/>
1516
</div>
1617
</div>
@@ -62,6 +63,8 @@
6263

6364
<%_ if (!rootOptions.router) { _%>
6465
const { VUE_APP_MODE, VUE_APP_PLATFORM } = process.env;
66+
<%_ } else { _%>
67+
const { VUE_APP_MODE } = process.env;
6568
<%_ } _%>
6669

6770
export default {
@@ -84,7 +87,7 @@
8487
this.$navigateTo(Home);
8588
},
8689
goToAboutPage() {
87-
this.$navigateTo(About);
90+
VUE_APP_MODE == 'web' ? this.$router.push('about') : this.$navigateTo(About);
8891
}
8992
<%_ } _%>
9093
}
@@ -101,9 +104,11 @@
101104
import About from '~/views/About.vue';
102105
<%_ } _%>
103106

104-
<%_ if (!rootOptions.router) { _%>
107+
<%_ if (!rootOptions.router) { _%>
105108
const { VUE_APP_MODE, VUE_APP_PLATFORM } = process.env;
106-
<%_ } _%>
109+
<%_ } else { _%>
110+
const { VUE_APP_MODE } = process.env;
111+
<%_ } _%>
107112

108113
@Component({
109114
name: 'home',
@@ -125,7 +130,7 @@
125130
}
126131

127132
public goToAboutPage() {
128-
Vue.prototype.$navigateTo(About);
133+
VUE_APP_MODE == 'web' ? this.$router.push('about') : Vue.prototype.$navigateTo(About);
129134
}
130135
<%_ } _%>
131136
}

Diff for: generator/templates/vue-sfc-template.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
<%# -------------------- IS Using vue-router -------------------- -%>
33
<%_ if (!options.isNativeOnly) { _%>
44
<template web></template>
5+
<template native>
6+
<%_ } else { _%>
7+
<template>
58
<%_ } _%>
6-
<template native></template>
79
<%_ } else { _%>
810
<%# -------------------- IS NOT Using vue-router -------------------- -%>
911
<%_ if (!options.isNativeOnly) { _%>
1012
<template web></template>
13+
<template native>
14+
<%_ } else { _%>
15+
<template>
1116
<%_ } _%>
12-
<template native></template>
1317
<%_ } _%>
1418
<%_ if (!usingTS && rootOptions.router) { _%>
1519
<%# -------------------- IS NOT Using TypeScript AND IS Using vue-router -------------------- -%>

Diff for: logo.png

2.78 KB
Loading

Diff for: ui.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* eslint-disable no-unused-vars */
2+
module.exports = (api) => {
3+
api.describeConfig({
4+
// Unique ID for the config
5+
id: 'org.nativescript-vue.plugin.cli',
6+
// Displayed name
7+
name: 'Nativescript-Vue CLI 3 Plugin',
8+
// Shown below the name
9+
description: 'A vue cli 3.x plugin for NativeScript-Vue',
10+
// "More info" link
11+
link: 'https://github.com/nativescript-vue/vue-cli-plugin-nativescript-vue#readme',
12+
onRead: ({ data, cwd }) => ({
13+
//
14+
}),
15+
onWrite: ({ prompts, answers, data, files, cwd, api }) => {
16+
//
17+
}
18+
});
19+
};

0 commit comments

Comments
 (0)