Skip to content

Commit

Permalink
chore: merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustAMan committed Nov 2, 2020
2 parents 55b3a2a + 20b69d8 commit 2276e55
Show file tree
Hide file tree
Showing 116 changed files with 1,823 additions and 1,611 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [0.0.18](https://github.com/kkbjs/element3/compare/v0.0.17...v0.0.18) (2020-10-27)



## [0.0.17](https://github.com/kkbjs/element3/compare/v0.0.16...v0.0.17) (2020-10-26)



## [0.0.16](https://github.com/kkbjs/element3/compare/v0.0.15...v0.0.16) (2020-10-25)


Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ npm install element3 -S
```js
import { createApp } from 'vue'
import App from './App.vue'
// import style
import "element3/lib/theme-chalk/index.css";
import Element3 from 'element3'

// global import
const app = createApp(App)
app.use(Element3)
createApp(App)
.use(Element3)
.mount("#app")

// or according to the need to import
import {
Expand All @@ -64,8 +67,10 @@ import {
// ...
} from 'element3'

app.component(ElLink.name, ElLink)
app.component(ElButton.name, ElButton)

createApp(App)
.use(ElLink)
.use(ElButton)
```

## Documentation
Expand Down Expand Up @@ -94,7 +99,7 @@ Thank you to all the people who already contributed to Element3!

Scan the QR code using [Dingtalk App](https://www.dingtalk.com/) to join in discussion group :

<img alt="Join Discusion Group" src="https://pic4.zhimg.com/80/v2-73947edcba4cbfe52cd779a3b1b974b5_1440w.png" width="300">
<img alt="Join Discusion Group" src="https://pic2.zhimg.com/50/v2-1442930ab968582ef6b959902ff71712_r.jpg" width="300">

## License

Expand Down
12 changes: 10 additions & 2 deletions build/md-loader/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ function genInlineComponentText(template, script) {
if (script) {
script = script
.replace(/export\s+default/, 'const democomponentExport =')
.replace(/import ([,{}\w\s]+) from ['"\w]+/g, function (s0, s1) {
return `const ${s1} = Vue`
.replace(/import ([,{}\w\s]+) from (['"\w]+)/g, function (s0, s1, s2) {
if (s2 === `'vue'`) {
return `
const ${s1} = Vue
`
} else if (s2 === `'element3'`) {
return `
const ${s1} = Element3
`
}
})
} else {
script = 'const democomponentExport = {}'
Expand Down
129 changes: 66 additions & 63 deletions examples/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,77 +9,80 @@
</template>

<script>
import { use } from 'main/locale';
import zhLocale from 'main/locale/lang/zh-CN';
import enLocale from 'main/locale/lang/en';
import esLocale from 'main/locale/lang/es';
import frLocale from 'main/locale/lang/fr';
import { use } from 'main/locale'
import zhLocale from 'main/locale/lang/zh-CN'
import enLocale from 'main/locale/lang/en'
import esLocale from 'main/locale/lang/es'
import frLocale from 'main/locale/lang/fr'
const lang = location.hash.replace('#', '').split('/')[1] || 'zh-CN';
const localize = lang => {
switch (lang) {
case 'zh-CN':
use(zhLocale);
break;
case 'es':
use(esLocale);
break;
case 'fr-FR':
use(frLocale);
break;
default:
use(enLocale);
}
};
localize(lang);
const lang = location.hash.replace('#', '').split('/')[1] || 'zh-CN'
const localize = (lang) => {
switch (lang) {
case 'zh-CN':
use(zhLocale)
break
case 'es':
use(esLocale)
break
case 'fr-FR':
use(frLocale)
break
default:
use(enLocale)
}
}
localize(lang)
export default {
name: 'app',
export default {
name: 'app',
computed: {
lang() {
return this.$route.path.split('/')[1] || 'zh-CN';
},
isComponent() {
return /^component-/.test(this.$route.name || '');
}
computed: {
lang() {
return this.$route.path.split('/')[1] || 'zh-CN'
},
isComponent() {
return /^component-/.test(this.$route.name || '')
}
},
watch: {
lang(val) {
if (val === 'zh-CN') {
this.suggestJump();
}
localize(val);
watch: {
lang(val) {
if (val === 'zh-CN') {
this.suggestJump()
}
},
localize(val)
}
},
methods: {
suggestJump() {
if (process.env.NODE_ENV !== 'production') return;
methods: {
suggestJump() {
if (process.env.NODE_ENV !== 'production') return
const href = location.href;
const preferGithub = localStorage.getItem('PREFER_GITHUB');
const cnHref = href.indexOf('eleme.cn') > -1 || href.indexOf('element-cn') > -1 || href.indexOf('element.faas') > -1;
if (cnHref || preferGithub) return;
setTimeout(() => {
if (this.lang !== 'zh-CN') return;
this.$confirm('建议大陆用户访问部署在国内的站点,是否跳转?', '提示')
.then(() => {
location.replace('https://element.eleme.cn');
})
.catch(() => {
localStorage.setItem('PREFER_GITHUB', 'true');
});
}, 1000);
}
},
const href = location.href
const preferGithub = localStorage.getItem('PREFER_GITHUB')
const cnHref =
href.indexOf('eleme.cn') > -1 ||
href.indexOf('element-cn') > -1 ||
href.indexOf('element.faas') > -1
if (cnHref || preferGithub) return
setTimeout(() => {
if (this.lang !== 'zh-CN') return
this.$confirm('建议大陆用户访问部署在国内的站点,是否跳转?', '提示')
.then(() => {
location.replace('https://element.eleme.cn')
})
.catch(() => {
localStorage.setItem('PREFER_GITHUB', 'true')
})
}, 1000)
}
},
mounted() {
localize(this.lang);
if (this.lang === 'zh-CN') {
this.suggestJump();
}
mounted() {
localize(this.lang)
if (this.lang === 'zh-CN') {
this.suggestJump()
}
};
}
}
</script>
Loading

0 comments on commit 2276e55

Please sign in to comment.