Coder Social home page Coder Social logo

fengyuan's Issues

Survey: extensibility for VueJS

Problem

We'd like some parts of the frontend dynamic and overridable, such as the sidebar previewer in Files app, the Files app itself should support showing basic file information like ctime and mtime, but it should leave advanced previewing to pluggable (and possibly third-party) plugins (implemented as a Django app). For example, to preview a JPEG file, user can install a "Photos" plugin, the plugin will override the previewer component, and display information specific to that file type, such as EXIF information.

Technical difficulty

Components in Vue must be built together if using .vue source files format. And there's no way to inherit or override code externally.

Solution 1: iframe and dynamic table

Sidebar will be in 2 parts: an iframe and a table. The iframe's URL will be static, some file metadata are passed as GET params, apps can override the view function to show custom content, such as for pictures the iframe can be an <img> and for sounds it can be <audio>. The table is used for text-based metadata, such as EXIF, plugins can simply respond with a JSON and Files app renders that into table cells.

Solution 2: AJAX-loaded template string

Vue component initialization allows template from string, which we can obtain via an out-of-band AJAX call, and allow plugins to override that string.
This is dirty.

Solution 3: x/template loaded template

Improved from sol2, template can be loaded from Django-rendered x/template element. Slightly better, still dirty. Related

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.