npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tyre

v0.1.4

Published

> 共通性vue组件生成工具

Downloads

8

Readme

Tyre

共通性vue组件生成工具

背景

在开发一些管理系统时,会有这样的场景:好几个 “ 筛选+结果列表” 这样的页面,这些页面的逻辑都大致相同,只是筛选条件不同,以及结果列表展示的字段也不同。从开发上来说,这属于重复性的工作。Tyre就是为了减少这样重复性工作的工具。

前提

Tyre基于ES6语法以及Vue框架,所以生成的标准文件是ES6语法的.vue文件。

Tyre的目的是解决 多个共通性页面 重复性工作的工具。所以,没有共同性的话,不怎么适用。

示例

1.安装

npm install tyre -g

2.创建模板文件

创建生成vue组件的模板文件 template.tpl ,使用<% %>作为占位符用于解析

<template>
    <h1> <%= title %> </h1>
    <div>
    <% if (true) { %>
        <%# input %>
    <% } %>
    </div>
</template>

3.创建数据配置文件

模板声明好了,需要data.json来配置相应的变量,作为数据依据

{
    "title" : "Hello Tyre",
    "input" : {
        "name" : "input",
        "value" : "val",
        "default" : "hello"
    }
}

完成以上步骤后通过命令行执行

tyre template.tpl data.json

执行完成后,将生成对应的data.vue文件

data.vue内容如下:

 <template>
    <h1> Hello Tyre </h1>
    <div> 
        <input v-model="val">
    </div>
    </div>
 </template>
 <script>
    export default {
        data () {
            return {
                val : 'hello'
            }
        }
    }
 </script>

tyre文档: https://yipian.gitbooks.io/tyre/content/