How to use the framework7.use function in framework7

To help you get started, we’ve selected a few framework7 examples, based on popular ways it is used in public projects.

github GuillaumeBiton / HackerNews7 / src / js / app.js View on Github external
import T7 from 'template7';
import Framework7 from 'framework7';

// import F7 components
import Tabs from 'framework7/components/tabs/tabs.js';
import Toolbar from 'framework7/components/toolbar/toolbar.js';
import Infinitescroll from 'framework7/components/infinite-scroll/infinite-scroll.js';

// Install F7 Components
Framework7.use([Tabs, Toolbar, Infinitescroll]);

// Template7 helpers
T7.registerHelper('pluralize', function (arr, options) {
  if (!arr) return '';
  if (typeof arr === "number") return (arr < 2) ? options.hash.single : options.hash.multiple;
  return (arr.length === 1) ? options.hash.single : arr.length + " " + options.hash.multiple;
});
// Template 7 Register partial
T7.registerPartial(
  'comments',
  '{{#each comments}}' +
      '<div class="message message-first message-last message-tail{{#js_if "@index%2 === 0"}} message-sent{{else}} message-received{{/js_if}}">' +
          '<div class="message-content">' +
              '<div class="message-name">{{user}}, {{time_ago}}</div>' +
              '<div class="message-bubble">' +
                  '<div class="message-text">{{content}}</div>' +
github gaynetdinov / ex_money / assets / js / app.js View on Github external
import "phoenix_html"
import socket from "./socket"

import Framework7 from 'framework7';
import Framework7Keypad from 'framework7-plugin-keypad';

Framework7.use(Framework7Keypad);

var $$ = Dom7;

function adjustSelectedCategory() {
  var category = $$('a.smart-select div.item-content div.item-inner div.item-after');
  category.text(category.text().replace(/\u21b3/g, ""));
};

function deleteTransaction() {
  $$('.tr-li').on('swipeout:deleted', function (e) {
    var id = $$(e.target).children("div.swipeout-actions-opened").find("a.delete-transaction").data('id');
    var csrf = document.querySelector("meta[name=csrf]").content;

    Framework7.request({
      url: '/m/transactions/' + id + "?_format=json",
      contentType: "application/json",