Pen Settings

HTML

CSS

CSS Base

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

Vue

              
                <!-- Use preprocessors via the lang attribute! e.g. <template lang="pug"> -->
<template>
  <section id="main" class="vh-100 gradient-custom-2">
    <div class="container py-5 h-100">
      <div class="row d-flex justify-content-center align-items-center h-100">
        <div class="col-md-12 col-xl-10">
          <div class="card mask-custom">
            <div class="card-body p-4 text-white">
              <div class="text-center pt-3 pb-2">
                <img
                  src="https://mdbootstrap.com/img/Photos/new-templates/bootstrap-todo-list/check1.png"
                  alt="Check"
                  width="60"
                />
                <h2 class="my-4">Todo Lists</h2>
                <button
                  type="button"
                  class="btn btn-success"
                  data-bs-toggle="modal"
                  data-bs-target="#exampleModal"
                >
                  Add Todo
                </button>
              </div>

              <table class="table text-white mb-0">
                <thead>
                  <tr>
                    <th scope="col">Team Member</th>
                    <th scope="col">Task</th>
                    <th scope="col">Priority</th>
                    <th scope="col">Actions</th>
                  </tr>
                </thead>
                <tbody>
                  <tr
                    v-for="(todo, index) in todos"
                    :key="index"
                    class="fw-normal"
                  >
                    <th>
                      <img
                        :src="todo.image"
                        alt="avatar 1"
                        style="width: 45px; height: auto"
                      />
                      <span class="ms-2">{{ todo.name }}</span>
                    </th>
                    <td class="align-middle">
                      <span :class="todo.completed ? 'completed' : ''">
                        {{ todo.task }}
                      </span>
                    </td>
                    <td class="align-middle">
                      <h6 class="mb-0">
                        <span
                          class="badge"
                          :class="
                            todo.priority == 1
                              ? 'bg-danger'
                              : todo.priority == 2
                              ? 'bg-success'
                              : 'bg-warning'
                          "
                        >
                          {{
                            todo.priority == 1
                              ? "High priority"
                              : todo.priority == 2
                              ? "Middle priority"
                              : "low priority"
                          }}
                        </span>
                      </h6>
                    </td>
                    <td class="align-middle">
                      <a
                        @click="completeTodo(index)"
                        data-mdb-toggle="tooltip"
                        :title="!todo.completed ? 'not completed' : 'Completed'"
                      >
                        <i
                          class="fas fa-check fa-lg me-3"
                          :class="
                            todo.completed ? 'text-success' : 'text-warning'
                          "
                        ></i>
                      </a>
                      <a
                        @click="removeTodo(index)"
                        data-mdb-toggle="tooltip"
                        title="Delete"
                      >
                        <i class="fas fa-trash-alt fa-lg text-warning"></i>
                      </a>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Add Modals -->
    <div
      class="modal fade"
      id="exampleModal"
      tabindex="-1"
      aria-labelledby="exampleModalLabel"
      aria-hidden="true"
    >
      <div class="modal-dialog" style="border-radius: 10px">
        <div class="modal-content gradient-custom-2">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Add New Todo</h5>
            <button
              type="button"
              class="btn-close"
              data-bs-dismiss="modal"
              aria-label="Close"
            ></button>
          </div>
          <div class="modal-body">
            <div class="card card-danger">
              <div class="card-body">
                <p>
                  <label for="name">Name</label>
                  <input
                    type="text"
                    v-model:value="name"
                    class="form-control"
                    id="name"
                  />
                </p>

                <p>
                  <label for="task">Task</label>
                  <input
                    type="text"
                    v-model:value="task"
                    class="form-control"
                    id="task"
                  />
                </p>

                <p>
                  <label>Priority</label>
                  <select v-model="priority" id="priority" class="form-select">
                    <option value="1">High Priority</option>
                    <option value="2">Middle Priority</option>
                    <option value="3">Low Priority</option>
                  </select>
                </p>
                <p>
                  <label>Image</label>
                  <select v-model="image" id="image" class="form-select">
                    <option disabled selected>Please Select Image</option>
                    <option v-for="image in images">{{ image }}</option>
                  </select>
                </p>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-secondary"
              data-bs-dismiss="modal"
            >
              Close
            </button>
            <button
              type="button"
              @click="addTodo"
              class="btn btn-success"
              data-bs-dismiss="modal"
            >
              Save changes
            </button>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>

<script>
// add vue js code with yaser sharifi zade
export default {
  data() {
    return {
      todos: [
        {
          image:
            "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava1-bg.png",
          name: "Alice Mayer",
          task: "Call Sam For payments",
          priority: 1, // 1:high, 2: middle, 3: low
          completed: false
        },
        {
          image:
            "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava2-bg.png",
          name: "Kate Moss",
          task: "Make payment to Bluedart",
          priority: 2, // 1:high, 2: middle, 3: low
          completed: false
        },
        {
          image:
            "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava3-bg.png",
          name: "Danny McChain",
          task: "Office rent",
          priority: 3, // 1:high, 2: middle, 3: low
          completed: false
        },
        {
          image:
            "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava5-bg.png",
          name: "Alexa Chung",
          task: "Office grocery shopping",
          priority: 2, // 1:high, 2: middle, 3: low
          completed: false
        },
        {
          image:
            "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava6-bg.png",
          name: "Ben Smith",
          task: "Ask for Lunch to Clients",
          priority: 1, // 1:high, 2: middle, 3: low
          completed: false
        }
      ],
      images: [
        "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava1-bg.png",
        "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava2-bg.png",
        "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava3-bg.png",
        "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava5-bg.png",
        "https://mdbootstrap.com/img/Photos/new-templates/bootstrap-chat/ava6-bg.png"
      ],
      image: "",
      name: "",
      task: "",
      priority: ""
    };
  },
  methods: {
    removeTodo: function (index) {
      this.todos.splice(index, 1);
    },
    completeTodo: function (index) {
      this.todos[index].completed = !this.todos[index].completed;
    },
    addTodo: function () {
      this.todos.unshift({
        image: this.image,
        name: this.name,
        task: this.task,
        priority: this.priority, // 1:high, 2: middle, 3: low
        completed: false
      });
    }
  }
};
</script>

<!-- Use preprocessors via the lang attribute! e.g. <style lang="scss"> -->
<style>
.gradient-custom-2 {
  /* fallback for old browsers */
  background: #7e40f6;

  /* Chrome 10-25, Safari 5.1-6 */
  background: -webkit-linear-gradient(
    to right,
    rgba(126, 64, 246, 1),
    rgba(80, 139, 252, 1)
  );

  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
  background: linear-gradient(
    to right,
    rgba(126, 64, 246, 1),
    rgba(80, 139, 252, 1)
  );
}

.mask-custom {
  background: rgba(24, 24, 16, 0.2);
  border-radius: 2em;
  backdrop-filter: blur(25px);
  border: 2px solid rgba(255, 255, 255, 0.05);
  background-clip: padding-box;
  box-shadow: 10px 10px 10px rgba(46, 54, 68, 0.03);
}
.completed {
  text-decoration-line: line-through;
}
</style>

              
            
!
999px

Console