Skip to content

Commit 8340cc2

Browse files
Update documentation
1 parent 8676068 commit 8340cc2

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<p align="center"><img <p align="center"><img width="100"src="../../Deploy/logo.png"></p>
2+
3+
# Migration from version 1.1.0 to 1.2.0
4+
5+
## Attention Point
6+
### Builds:
7+
8+
Version 1.2.0 supports x64 builds. There some gotchas thought:
9+
10+
- Make sure to disable project flag "Prefer 32-bit" (Properties>Build).
11+
- Make sure that all the projects of the solution have the same platform value. Supported values: `x86`, `x64` or `Any CPU`.
12+
13+
14+
## Template created from `neutronium-vue`
15+
16+
1) Update dependencies version in `package.json`:
17+
18+
```
19+
"vue": "^2.5.13",
20+
"vue-template-compiler": "^2.5.13"
21+
```
22+
23+
2) Update `main.js` file.
24+
- First install `neutronium-vm-loader`:
25+
26+
```bash
27+
npm install --save-dev neutronium-vm-loader
28+
```
29+
30+
- Then update `main.js`<br>
31+
From:
32+
33+
```js
34+
import Vue from 'vue'
35+
import App from './App.vue'
36+
import rawVm from '../data/vm'
37+
import CircularJson from 'circular-json'
38+
import {install} from './install'
39+
40+
function updateVm(vm) {
41+
var window = vm.__window__
42+
if (window) {
43+
delete vm.__window__
44+
return { ViewModel: vm, Window: window }
45+
}
46+
return vm;
47+
}
48+
const vm = updateVm(CircularJson.parse(rawVm));
49+
50+
install(Vue)
51+
new Vue({
52+
components:{
53+
App
54+
},
55+
el: '#main',
56+
data: vm
57+
})
58+
```
59+
60+
To:
61+
```js
62+
import Vue from 'vue'
63+
import App from './App.vue'
64+
import rawVm from '../data/vm'
65+
import {install} from './install'
66+
import { createVM } from 'neutronium-vm-loader'
67+
68+
const vm = createVM(rawVm);
69+
70+
install(Vue)
71+
new Vue({
72+
components:{
73+
App
74+
},
75+
el: '#main',
76+
data: vm
77+
})
78+
```
79+
80+
3) Optional step: update `dist\index.html`
81+
82+
If you want to take advantage of the possibility of loading Vue runtime only to improve performance, perform the following changes:
83+
84+
- Update `dist\index.html`
85+
86+
From:
87+
```HTML
88+
<body>
89+
<div id="main">
90+
<App :view-model="$data.ViewModel" :__window__="$data.Window">
91+
</App>
92+
</div>
93+
<script src="./build.js"></script>
94+
</body>
95+
```
96+
97+
To:
98+
```HTML
99+
<body>
100+
<div id="main"">
101+
</div>
102+
<script src="./build.js"></script>
103+
</body>
104+
```
105+
106+
- Update `entry.js`
107+
108+
From:
109+
```js
110+
import Vue from 'vue'
111+
import App from './App.vue'
112+
import {install, vueInstanceOption} from './install'
113+
import vueHelper from 'vueHelper'
114+
115+
install(Vue)
116+
vueHelper.setOption(vueInstanceOption)
117+
Vue.component('app', App)
118+
```
119+
120+
To:
121+
```js
122+
import Vue from 'vue'
123+
import App from './App.vue'
124+
import {install, vueInstanceOption} from './install'
125+
import vueHelper from 'vueHelper'
126+
127+
128+
function buildVueOption(vm) {
129+
var option = vueInstanceOption(vm);
130+
option.render = function (h) {
131+
const prop = {
132+
props: {
133+
viewModel: this.$data.ViewModel,
134+
__window__: this.$data.Window
135+
}
136+
};
137+
return h(App, prop);
138+
}
139+
return option;
140+
}
141+
142+
install(Vue)
143+
vueHelper.setOption(buildVueOption)
144+
```
145+
146+
-Finally to use runtime only Vue in Neutronium change in `App.xaml.cs`:
147+
148+
```CSharp
149+
factory.RegisterJavaScriptFramework(new VueSessionInjectorV2());
150+
```
151+
152+
To:
153+
```CSharp
154+
factory.RegisterJavaScriptFramework(new VueSessionInjectorV2 {RunTimeOnly = true});
155+
```

0 commit comments

Comments
 (0)