Vue.js 导入 mixin 不在应用程序中导入
Vue.js Import mixin does not import in app
The requested module './clienteMixin.js' does not provide an export named 'default'
混音
export const myMixin = {
data() {
return {
loading: false,
}
}
}
查看应用程序
import myMixin from './clienteMixin.js'
var app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
components:{},
mixins: [myMixin],
data() {
return {
}
},
methods: {
},
mounted () {
}
});
首先将导出更改为使用 default
导出:
export default {
data() {
return {
loading: false,
}
},
}
这将解决导入问题。如果你想让你的 mixin 成为 global mixin, use Vue.mixin
:
import myMixin from './clienteMixin.js'
Vue.mixin(myMixin);
const app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
components:{},
data() {
return {
}
},
methods: {
},
mounted () {
}
});
The requested module './clienteMixin.js' does not provide an export named 'default'
混音
export const myMixin = {
data() {
return {
loading: false,
}
}
}
查看应用程序
import myMixin from './clienteMixin.js'
var app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
components:{},
mixins: [myMixin],
data() {
return {
}
},
methods: {
},
mounted () {
}
});
首先将导出更改为使用 default
导出:
export default {
data() {
return {
loading: false,
}
},
}
这将解决导入问题。如果你想让你的 mixin 成为 global mixin, use Vue.mixin
:
import myMixin from './clienteMixin.js'
Vue.mixin(myMixin);
const app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
components:{},
data() {
return {
}
},
methods: {
},
mounted () {
}
});