【问题标题】:Vuetify setting right to left textVuetify 设置从右到左的文本
【发布时间】:2021-01-02 19:20:41
【问题描述】:

我添加了 Vuetify 使用:

vue add vuetify

生成的文件如下所示:

import Vue from "vue";
import App from "./App.vue";
import vuetify from "./plugins/vuetify";

Vue.config.productionTip = false;

new Vue({
  vuetify,
  render: (h) => h(App)
}).$mount("#app");

我尝试添加 RTL 进行休闲:

import vuetify from "./plugins/vuetify";

const Vuetify = new vuetify({
  rtl: true
});;
Vue.config.productionTip = false;

new Vue({
  Vuetify, 
  render: (h) => h(App)
}).$mount("#app");

遇到错误:Uncaught TypeError: _plugins_vuetify__WEBPACK_IMPORTED_MODULE_8__.default is not a constructor

并尝试了这个:

Vue.use(Vuetify, {
  rtl: true
})

Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App)
}).$mount("#app");

出现错误: Error in beforeCreate hook: "Error: Vuetify is not properly initialized,

我错过了什么?

【问题讨论】:

    标签: vue.js vuetify.js


    【解决方案1】:

    你没有在正确的地方改变它。看起来您正在尝试修改文件main.js,您应该改为修改src/plugins/vuetify.js 的文件。还要确保在export default 下进行,如documentation 中所述。

    像这样:

    // src/plugins/vuetify.js
    
    import Vue from 'vue'
    import Vuetify from 'vuetify/lib'
    
    Vue.use(Vuetify)
    
    export default new Vuetify({
      rtl: true,
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      • 2018-01-05
      • 1970-01-01
      • 2013-12-16
      • 1970-01-01
      • 2016-02-01
      相关资源
      最近更新 更多