Skip to content

Commit bb7542f

Browse files
author
TitanSnow
committed
use inject instead of mixin
1 parent 68c97df commit bb7542f

File tree

5 files changed

+6
-14
lines changed

5 files changed

+6
-14
lines changed

src/components/Dialog.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114
<script>
115115
import 'font-awesome/css/font-awesome.css'
116116
import DialogComponents from './dialog-input-components/components'
117-
import { mixin as getTextMixin } from './i18n'
118117
119118
export default {
120119
name: 'editor-dialog',
@@ -156,6 +155,6 @@ export default {
156155
}
157156
},
158157
components: DialogComponents,
159-
mixins: [getTextMixin]
158+
inject: ['t']
160159
}
161160
</script>

src/components/MarkdownPalettes.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ import EditorDialog from './Dialog.vue'
9494
import { defaultConfig, getConfig } from './DefaultConfig'
9595
import { contentParserFactory } from './ContentParserFactory'
9696
import InjectLnParser from './plugins/InjectLnParser.js'
97+
import { getText } from './i18n'
9798
9899
export default {
99100
name: 'markdown-palettes',
@@ -182,6 +183,7 @@ export default {
182183
this.code = newValue
183184
this.updateCode(newValue)
184185
}
185-
}
186+
},
187+
provide: () => ({ t: getText })
186188
}
187189
</script>

src/components/Toolbar.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464

6565
<script>
6666
import 'font-awesome/css/font-awesome.css'
67-
import { mixin as getTextMixin } from './i18n'
6867
6968
/**
7069
* configItem = {
@@ -108,6 +107,6 @@ export default {
108107
}
109108
}
110109
},
111-
mixins: [getTextMixin]
110+
inject: ['t']
112111
}
113112
</script>

src/components/dialog-input-components/AbstractInputComponent.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { mixin as getTextMixin } from '../i18n'
2-
31
export default {
42
props: {
53
requestField: {
@@ -26,5 +24,5 @@ export default {
2624
this.$emit('change', this.request)
2725
}
2826
},
29-
mixins: [getTextMixin]
27+
inject: ['t']
3028
}

src/components/i18n.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,3 @@ export function getText (text) {
6969
}
7070
return text
7171
}
72-
73-
export const mixin = {
74-
methods: {
75-
t: getText
76-
}
77-
}

0 commit comments

Comments
 (0)