在laravel vue中无法获取夏季笔记

时间:2018-08-14 01:34:48

标签: laravel vue.js summernote

我正试图在laravel中获得Summernote与vue的联系,但无法正常工作。

我做了什么

  1. 安装夏季笔记
  2. bootstrap.js中导入summernote js文件
  

require('summernote / dist / summernote-bs4.js');

  1. summernote中导入app.scss样式表
  

@import'〜summernote / dist / summernote-bs4.css';

  1. 运行npm run watch

  2. 在我的组件ready部分中添加了以下代码

    从'validate.js'导入验证;
    export default {
        data: function () {
            return {
                project: {
                    title: '',
                    body: '',
                    attachment: '',
                    projectclass: '',
                    deadline: '',
                    budget: 0,
                    user_id: '',
                    report_type: '',
                    csrf: document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
                },
                errors: null
            }
        },
        computed: {
            currentUser() {
                return this.$store.getters.currentUser;
            }
        },
        methods: {
            add() {
                this.errors = null;
                const errors = validate(Object.assign(this.$data.project, {user_id: this.currentUser.id}));
                if(errors) {
                    this.errors = errors;
                    return;
                }
                axios.post('/api/projects/new', Object.assign(this.$data.project, {user_id: this.currentUser.id})).then((response) => {
                    this.$router.push('/projects')
                });
                Vue.nextTick(function () {
                    $('[data-toggle="tooltip"]').tooltip();
                })
            }
        },
        ready: function() {
            var config = {};
            var that = this;
            config.minHeight = null;
                config.maxHeight = null;
                config.toolbar =  [
                        ['style', ['bold', 'italic', 'underline', 'clear']],
                        ['color', ['color']],
                        ['para', ['ul', 'ol', 'paragraph']],
                        ['height', ['height']]
                ];
    
            config.onBlur = function(e) {
                    that.body = $('#summernote').code();
            };
            $('#summernote').summernote(config);
        },
        watch: {
            budget: function(newValue) {
                const result = newValue.replace(/\D/g, "")
                    .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                Vue.nextTick(() => this.budget = result);
            },
        }
    }
    

我得到的东西

one

问题

  1. 我在哪里出错了?
  2. 如何解决?

0 个答案:

没有答案