web-component-gallery 1.1.12 → 1.1.13

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,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-gallery",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "vue-library-ui组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "files": [
@@ -7,18 +7,31 @@ export default {
7
7
  Vue.prototype.$setTheme = function(theme) {
8
8
  /** 判断是否属于内嵌项目 */
9
9
  if(window.parent !== window) {
10
- return
10
+ return ToggleThemeSource(theme)
11
11
  }
12
12
  ToggleTheme(theme)
13
13
  }
14
14
 
15
15
  /** 切换当前主题 */
16
16
  function ToggleTheme(scopeName) {
17
+ /** 切换主题loading */
18
+ const hideMessage = message.loading('正在切换主题!', 0)
19
+
20
+ ToggleThemeSource(scopeName)
21
+
22
+ const loadingTimer=setTimeout(() => {
23
+ hideMessage()
24
+ clearTimeout(loadingTimer)
25
+ }, 10)
26
+
27
+ Vue.prototype.$store.commit('SET_THEME',scopeName)
28
+ }
29
+
30
+ /** 切换主题资源 */
31
+ function ToggleThemeSource(scopeName) {
17
32
  /** 获取初始配置项 */
18
33
  // env.themeConfig 来源 vue.config.js define (webpack的DefinePlugin)
19
34
  const themeConfig = env.themeConfig
20
- /** 切换主题loading */
21
- const hideMessage = message.loading('正在切换主题!', 0)
22
35
  /** 主题配置
23
36
  * @scopeName 名称
24
37
  * @multipleScopeVars 主题项
@@ -32,19 +45,13 @@ export default {
32
45
  extract: themeConfig.extract,
33
46
  publicPath: themeConfig.publicPath,
34
47
  outputDir: themeConfig.extractCssOutputDir
35
- })
36
- const loadingTimer=setTimeout(() => {
37
- hideMessage()
38
- clearTimeout(loadingTimer)
39
- }, 10)
48
+ })
40
49
 
41
50
  /** 加载主题对应样式文件 */
42
51
  // const requireLess = require.context('@/theme/styles', false, /\.less$/)
43
52
  // requireLess(`./${scopeName}.less`)
44
53
  let themeLink = document.getElementById('theme-stylesheet')
45
54
  themeLink.href = `${process.env.BASE_URL}static/style/${scopeName}.css`
46
-
47
- Vue.prototype.$store.commit('SET_THEME',scopeName)
48
55
  }
49
56
 
50
57
  }