Friday, September 20, 2024 2:39:33 AM
> settings

Customize


Authenticate

> index.js
import Vue from 'vue/dist/vue.esm.js';
import {
    getData
} from "../utilities";

export default function (elem) {
    const data = getData(elem, ["content"]);

    const app = new Vue({
        el: elem,
        data: {
          content: data.content,
          maxCharacterCount: 1500
        },
        computed: {
          characterCount: function() {
            if (_.isEmpty(this.content)) return 0;

            return _.size(this.content);
          },
          limitReached: function() {
            return this.characterCount >= this.maxCharacterCount;
          }
        },
        methods: {
          onKeyDown: function() {
            if (!this.limitReached) return;

            this.content = this.content.substring(0, this.maxCharacterCount);
          }
        }
    });
}
All opinions represented herein are my own
- © 2024 itsthedevman
- build 340fbb8