質問編集履歴
1
色々と変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,19 +4,45 @@
|
|
4
4
|
|
5
5
|
```
|
6
6
|
|
7
|
+
import Vue from "vue";
|
8
|
+
|
9
|
+
import VueRouter from "vue-router";
|
10
|
+
|
11
|
+
Vue.use(VueRouter);
|
12
|
+
|
13
|
+
import Page2 from '../pages/page2.vue'
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
7
19
|
const routes =[
|
8
20
|
|
9
|
-
|
21
|
+
{
|
10
22
|
|
11
|
-
|
23
|
+
path: '/page2',
|
12
24
|
|
13
|
-
|
25
|
+
component: Page2
|
14
26
|
|
15
|
-
component: users,
|
16
|
-
|
17
|
-
|
27
|
+
}
|
18
28
|
|
19
29
|
];
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
const router = new VueRouter({
|
34
|
+
|
35
|
+
routes,
|
36
|
+
|
37
|
+
base: process.env.BASE_URL,
|
38
|
+
|
39
|
+
mode: 'history'
|
40
|
+
|
41
|
+
});
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
export default router;
|
20
46
|
|
21
47
|
```
|
22
48
|
|
@@ -38,13 +64,19 @@
|
|
38
64
|
|
39
65
|
namespace :v1 do
|
40
66
|
|
67
|
+
root to: 'home#index'
|
68
|
+
|
41
|
-
resources :users, only: [:index,
|
69
|
+
resources :users, only: [:index,:show, :update]
|
42
70
|
|
43
71
|
end
|
44
72
|
|
45
73
|
end
|
46
74
|
|
75
|
+
get '/page2', to: 'api/v1/users#show'
|
76
|
+
|
47
77
|
end
|
78
|
+
|
79
|
+
|
48
80
|
|
49
81
|
```
|
50
82
|
|
@@ -55,3 +87,71 @@
|
|
55
87
|
それとも更新を押してもusers.vueを呼び出す様ないい方法があるのでしょうか?
|
56
88
|
|
57
89
|
SPA周りがあまり詳しくなく疑問に思っています。よろしくお願いします。
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
###追記
|
96
|
+
|
97
|
+
```ここに言語を入力
|
98
|
+
|
99
|
+
js構成
|
100
|
+
|
101
|
+
javascript
|
102
|
+
|
103
|
+
-packs
|
104
|
+
|
105
|
+
|_pages2.js
|
106
|
+
|
107
|
+
|_application.js
|
108
|
+
|
109
|
+
-pages
|
110
|
+
|
111
|
+
|_pages2.vue
|
112
|
+
|
113
|
+
-router
|
114
|
+
|
115
|
+
|_router.js
|
116
|
+
|
117
|
+
```
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
```ここに言語を入力
|
122
|
+
|
123
|
+
//application.html.erb
|
124
|
+
|
125
|
+
<!DOCTYPE html>
|
126
|
+
|
127
|
+
<html>
|
128
|
+
|
129
|
+
<head>
|
130
|
+
|
131
|
+
<title>PerformaApps</title>
|
132
|
+
|
133
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
134
|
+
|
135
|
+
<%= csrf_meta_tags %>
|
136
|
+
|
137
|
+
<%= csp_meta_tag %>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
142
|
+
|
143
|
+
<%= javascript_pack_tag 'application' %>
|
144
|
+
|
145
|
+
</head>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<body>
|
150
|
+
|
151
|
+
<%= yield %>
|
152
|
+
|
153
|
+
</body>
|
154
|
+
|
155
|
+
</html>
|
156
|
+
|
157
|
+
```
|