vue2-client 1.8.273 → 1.8.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,263 +1,263 @@
|
|
|
1
1
|
<template><div ref="domRef">Loading...</div></template>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
// import 'amis/sdk/sdk.js'
|
|
5
|
-
// import 'amis/sdk/sdk.css'
|
|
6
|
-
// import 'amis/sdk/iconfont.css'
|
|
7
|
-
|
|
8
|
-
// 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
|
-
// https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
-
// import 'amis/sdk/helper.css'
|
|
11
|
-
import qs from 'qs'
|
|
12
|
-
import Vue from 'vue'
|
|
13
|
-
import Index from '@vue2-client/base-client/components/index.js'
|
|
14
|
-
import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
|
|
15
|
-
|
|
16
|
-
let React
|
|
17
|
-
let amisLib
|
|
18
|
-
let scoped
|
|
19
|
-
const apps = {}
|
|
20
|
-
function loadScript (src, callback) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
const vueList = {}
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line no-unused-vars
|
|
31
|
-
function CustomComponent (props, dom) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function loadStyles (styles) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
// eslint-disable-next-line no-unused-vars
|
|
68
|
-
function appstyle (data) {
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
// 动态导入组件
|
|
72
|
-
|
|
73
|
-
function loadSDK () {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export default {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
4
|
+
// // import 'amis/sdk/sdk.js'
|
|
5
|
+
// // import 'amis/sdk/sdk.css'
|
|
6
|
+
// // import 'amis/sdk/iconfont.css'
|
|
7
|
+
//
|
|
8
|
+
// // 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
|
+
// // https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
+
// // import 'amis/sdk/helper.css'
|
|
11
|
+
// import qs from 'qs'
|
|
12
|
+
// import Vue from 'vue'
|
|
13
|
+
// import Index from '@vue2-client/base-client/components/index.js'
|
|
14
|
+
// import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
|
|
15
|
+
//
|
|
16
|
+
// let React
|
|
17
|
+
// let amisLib
|
|
18
|
+
// let scoped
|
|
19
|
+
// const apps = {}
|
|
20
|
+
// function loadScript (src, callback) {
|
|
21
|
+
// const script = document.createElement('script')
|
|
22
|
+
// script.setAttribute('type', 'text/javascript')
|
|
23
|
+
// script.setAttribute('src', src)
|
|
24
|
+
// script.onload = () => callback()
|
|
25
|
+
// script.onerror = () => callback(new Error(`Failed to load ${src}`))
|
|
26
|
+
// document.body.appendChild(script)
|
|
27
|
+
// }
|
|
28
|
+
// const vueList = {}
|
|
29
|
+
//
|
|
30
|
+
// // eslint-disable-next-line no-unused-vars
|
|
31
|
+
// function CustomComponent (props, dom) {
|
|
32
|
+
// const store = Vue.$store
|
|
33
|
+
// const router = Vue.$router
|
|
34
|
+
// const i18n = Vue.$i18n
|
|
35
|
+
// console.log('props', props)
|
|
36
|
+
// React.useEffect(function () {
|
|
37
|
+
// vueList[props.$schema.name] = new Vue({
|
|
38
|
+
// router,
|
|
39
|
+
// store,
|
|
40
|
+
// i18n,
|
|
41
|
+
// render: h => h(Index[props.$schema.type], {
|
|
42
|
+
// props: props.$schema
|
|
43
|
+
// })
|
|
44
|
+
// }).$mount(dom.current)
|
|
45
|
+
// }, [])
|
|
46
|
+
// const app = React.createElement('div', {
|
|
47
|
+
// ref: dom
|
|
48
|
+
// })
|
|
49
|
+
// if (apps[props.name] !== undefined) {
|
|
50
|
+
// const vue = vueList[props.$schema.name]
|
|
51
|
+
// vue.$children[0].active(props.data)
|
|
52
|
+
// } else {
|
|
53
|
+
// apps[props.name] = app
|
|
54
|
+
// }
|
|
55
|
+
// return app
|
|
56
|
+
// }
|
|
57
|
+
//
|
|
58
|
+
// function loadStyles (styles) {
|
|
59
|
+
// for (const path of styles) {
|
|
60
|
+
// const style = document.createElement('link')
|
|
61
|
+
// style.setAttribute('rel', 'stylesheet')
|
|
62
|
+
// style.setAttribute('type', 'text/css')
|
|
63
|
+
// style.setAttribute('href', path)
|
|
64
|
+
// document.head.appendChild(style)
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
// // eslint-disable-next-line no-unused-vars
|
|
68
|
+
// function appstyle (data) {
|
|
69
|
+
// console.log('111111111111')
|
|
70
|
+
// }
|
|
71
|
+
// // 动态导入组件
|
|
72
|
+
//
|
|
73
|
+
// function loadSDK () {
|
|
74
|
+
// return new Promise((resolve, reject) => {
|
|
75
|
+
// if (window.amisRequire) {
|
|
76
|
+
// resolve()
|
|
77
|
+
// return
|
|
78
|
+
// }
|
|
79
|
+
// loadStyles([
|
|
80
|
+
// '/amis/sdk/sdk.css',
|
|
81
|
+
// '/amis/sdk/helper.css',
|
|
82
|
+
// '/amis/sdk/iconfont.css',
|
|
83
|
+
// ])
|
|
84
|
+
// loadScript('/amis/sdk/sdk.js', (err) => {
|
|
85
|
+
// if (err) {
|
|
86
|
+
// reject(err)
|
|
87
|
+
// return
|
|
88
|
+
// }
|
|
89
|
+
// resolve()
|
|
90
|
+
// })
|
|
91
|
+
// })
|
|
92
|
+
// }
|
|
93
|
+
//
|
|
94
|
+
// export default {
|
|
95
|
+
// name: 'AMISRenderer',
|
|
96
|
+
// components: {},
|
|
97
|
+
// props: {
|
|
98
|
+
// schema: {
|
|
99
|
+
// type: Object,
|
|
100
|
+
// default: {
|
|
101
|
+
// type: 'page',
|
|
102
|
+
// body: 'Hello World!',
|
|
103
|
+
// },
|
|
104
|
+
// },
|
|
105
|
+
// locals: {
|
|
106
|
+
// type: Object,
|
|
107
|
+
// default: () => ({}),
|
|
108
|
+
// },
|
|
109
|
+
// props: {
|
|
110
|
+
// type: Object,
|
|
111
|
+
// default: () => ({}),
|
|
112
|
+
// },
|
|
113
|
+
// env: {
|
|
114
|
+
// type: Object,
|
|
115
|
+
// default: () => ({}),
|
|
116
|
+
// },
|
|
117
|
+
// },
|
|
118
|
+
// data () {
|
|
119
|
+
// const router = this.$router
|
|
120
|
+
// return {
|
|
121
|
+
// // 这里面的数据所有 amis 页面都可以获取到
|
|
122
|
+
// // 可以用来放一下公共数据,比如用户信息等
|
|
123
|
+
// // 不要放受控数据,受控数据应该通过 data 下发
|
|
124
|
+
// context: {
|
|
125
|
+
// siteName: 'AMIS DEMO',
|
|
126
|
+
// },
|
|
127
|
+
// get location () {
|
|
128
|
+
// const current = router.history.current
|
|
129
|
+
// return {
|
|
130
|
+
// pathname: current.path,
|
|
131
|
+
// hash: current.hash,
|
|
132
|
+
// query: current.query,
|
|
133
|
+
// search: `?${qs.stringify(current.query)}`,
|
|
134
|
+
// }
|
|
135
|
+
// },
|
|
136
|
+
// loading: false,
|
|
137
|
+
// amisInstance: null,
|
|
138
|
+
// unmounted: false,
|
|
139
|
+
// applist: {}
|
|
140
|
+
// }
|
|
141
|
+
// },
|
|
142
|
+
//
|
|
143
|
+
// watch: {
|
|
144
|
+
// locals: function () {
|
|
145
|
+
// this.updateProps()
|
|
146
|
+
// },
|
|
147
|
+
// props: function () {
|
|
148
|
+
// this.updateProps()
|
|
149
|
+
// },
|
|
150
|
+
// $route: function () {
|
|
151
|
+
// this.updateProps()
|
|
152
|
+
// },
|
|
153
|
+
// },
|
|
154
|
+
// async mounted () {
|
|
155
|
+
// try {
|
|
156
|
+
// this.loading = true
|
|
157
|
+
// await loadSDK()
|
|
158
|
+
// } finally {
|
|
159
|
+
// this.loading = false
|
|
160
|
+
// }
|
|
161
|
+
// if (this.unmounted) {
|
|
162
|
+
// return
|
|
163
|
+
// }
|
|
164
|
+
// React = window.amisRequire('react')
|
|
165
|
+
// amisLib = window.amisRequire('amis')
|
|
166
|
+
// scoped = window.amisRequire('amis/embed')
|
|
167
|
+
// const { normalizeLink } = amisLib
|
|
168
|
+
// const router = this.$router
|
|
169
|
+
// // eslint-disable-next-line no-prototype-builtins
|
|
170
|
+
// // console.log('this.schema.type', this.schema.type)
|
|
171
|
+
//
|
|
172
|
+
// amisLib.Renderer({
|
|
173
|
+
// test: new RegExp(`(^|\/)${this.schema.type}`)
|
|
174
|
+
// })(props => CustomComponent(props, this.$el))
|
|
175
|
+
//
|
|
176
|
+
// const instance = scoped.embed(
|
|
177
|
+
// this.$el,
|
|
178
|
+
// this.schema,
|
|
179
|
+
// {
|
|
180
|
+
// data: {
|
|
181
|
+
// ...this.locals,
|
|
182
|
+
// },
|
|
183
|
+
// context: this.context,
|
|
184
|
+
// location: this.location,
|
|
185
|
+
//
|
|
186
|
+
// // todo 下发 location 对象
|
|
187
|
+
// ...this.props,
|
|
188
|
+
// },
|
|
189
|
+
// {
|
|
190
|
+
// requestAdaptor (api) {
|
|
191
|
+
// api.headers.Authorization = localStorage.getItem(ACCESS_TOKEN)
|
|
192
|
+
// return api
|
|
193
|
+
// },
|
|
194
|
+
// // 覆盖 amis env
|
|
195
|
+
// // 参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/start/getting-started#sdk
|
|
196
|
+
// jumpTo: (to, action) => {
|
|
197
|
+
// if (to === 'goBack') {
|
|
198
|
+
// return router.go(-1)
|
|
199
|
+
// }
|
|
200
|
+
//
|
|
201
|
+
// to = normalizeLink(to, this.location)
|
|
202
|
+
//
|
|
203
|
+
// if (action?.actionType === 'url') {
|
|
204
|
+
// action.blank === false ? router.push(to) : window.open(to)
|
|
205
|
+
// return
|
|
206
|
+
// }
|
|
207
|
+
//
|
|
208
|
+
// // 主要是支持 nav 中的跳转
|
|
209
|
+
// if (action && to && action.target) {
|
|
210
|
+
// window.open(to, action.target)
|
|
211
|
+
// return
|
|
212
|
+
// }
|
|
213
|
+
//
|
|
214
|
+
// if (/^https?:\/\//.test(to)) {
|
|
215
|
+
// window.location.replace(to)
|
|
216
|
+
// } else {
|
|
217
|
+
// router.push(to)
|
|
218
|
+
// }
|
|
219
|
+
// },
|
|
220
|
+
//
|
|
221
|
+
// updateLocation: (location, replace) => {
|
|
222
|
+
// if (location === 'goBack') {
|
|
223
|
+
// return router.go(-1)
|
|
224
|
+
// }
|
|
225
|
+
//
|
|
226
|
+
// location = normalizeLink(location, this.location)
|
|
227
|
+
// replace ? router.replace(location) : router.replace(location)
|
|
228
|
+
// },
|
|
229
|
+
//
|
|
230
|
+
// ...this.env,
|
|
231
|
+
// },
|
|
232
|
+
// () => {
|
|
233
|
+
// this.$emit('ready', {
|
|
234
|
+
// instance,
|
|
235
|
+
// })
|
|
236
|
+
// }
|
|
237
|
+
// )
|
|
238
|
+
// this.amisInstance = instance
|
|
239
|
+
// },
|
|
240
|
+
//
|
|
241
|
+
// methods: {
|
|
242
|
+
// updateProps () {
|
|
243
|
+
// // eslint-disable-next-line no-unused-expressions
|
|
244
|
+
// this.amisInstance?.updateProps({
|
|
245
|
+
// data: {
|
|
246
|
+
// ...this.locals,
|
|
247
|
+
// },
|
|
248
|
+
// context: this.context,
|
|
249
|
+
// ...this.props,
|
|
250
|
+
// })
|
|
251
|
+
// },
|
|
252
|
+
// initConfig () {
|
|
253
|
+
// console.warn('initConfig')
|
|
254
|
+
// }
|
|
255
|
+
// },
|
|
256
|
+
//
|
|
257
|
+
// destroyed () {
|
|
258
|
+
// this.unmounted = true
|
|
259
|
+
// // eslint-disable-next-line no-unused-expressions
|
|
260
|
+
// this.amisInstance?.unmount()
|
|
261
|
+
// },
|
|
262
|
+
// }
|
|
263
263
|
</script>
|