HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div id="app">
<vuetable ref="vuetable"
:fields="fields"
:api-mode="false"
:data-manager="dataManager"
pagination-path="pagination"
@vuetable:pagination-data="onPaginationData"
@vuetable:loading="onLoading"
@vuetable:loaded="onLoaded"
>
<div slot="gender-slot" slot-scope="props">
<span v-if="props.rowData.gender === 'M'" class="ui teal label"><i class="large man icon"></i>Male</span>
<span v-else class="ui pink label"><i class="large woman icon"></i>Female</span>
</div>
<div slot="none" slot-scope="props">
<button @click="console.log(props.rowData)">Click</button>
</div>
</vuetable>
<vuetable-pagination ref="pagination"
@vuetable-pagination:change-page="onChangePage"
></vuetable-pagination>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetable-2.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.css">
#app {
padding:25px;
max-width:960px;
}
Vue.use(Vuetable);
new Vue({
el: '#app',
components: {
'vuetable-pagination': Vuetable.VuetablePagination
},
data() {
return {
fields: ['name', 'nickname', 'email', 'gender'],
perPage: 3,
data:[],
localData: [
{"id":1,"name":"Noelia O'Kon","nickname":"asperiores","email":"[email protected]","birthdate":"1978-06-28 00:00:00","gender":"F","salary":"13098.00","group_id":2,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":41,"group":{"id":2,"name":"Exec","description":"Executives"},"address":{"id":1,"user_id":1,"line1":"0888 Aniyah Locks\nLake Bridie, NJ 51086","line2":"Cayman Islands","zipcode":"92991-2805","mobile":"1-742-816-9238x848","fax":"(484)438-4697x8638"}},
{"id":2,"name":"Mr. Enid Von PhD","nickname":"alias","email":"[email protected]","birthdate":"1990-09-18 00:00:00","gender":"M","salary":"35978.00","group_id":4,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":29,"group":{"id":4,"name":"Sup","description":"Supervisors"},"address":{"id":2,"user_id":2,"line1":"59732 Iva Spur Suite 468\nEast Hortenseton, VA 70087","line2":"Cayman Islands","zipcode":"41967","mobile":"1-913-407-7558x503","fax":"(388)906-8002"}},
{"id":3,"name":"Colton Koch","nickname":"id","email":"[email protected]","birthdate":"1968-10-29 00:00:00","gender":"F","salary":"26278.00","group_id":3,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":51,"group":{"id":3,"name":"Mgr","description":"Managers"},"address":{"id":3,"user_id":3,"line1":"539 Conn Locks Suite 801\nTobinfort, IL 37047-5508","line2":"Antigua and Barbuda","zipcode":"51722-4502","mobile":"557.845.1830x844","fax":"1-831-304-7444x73027"}},
{"id":4,"name":"Gregory Vandervort","nickname":"vel","email":"[email protected]","birthdate":"1989-12-12 00:00:00","gender":"M","salary":"25537.00","group_id":3,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":29,"group":{"id":3,"name":"Mgr","description":"Managers"},"address":{"id":4,"user_id":4,"line1":"916 Rosemary Forge\nKreigerton, MT 24207","line2":"Uganda","zipcode":"67639-6707","mobile":"766.431.9121","fax":"(154)336-3674x08451"}},
{"id":5,"name":"Miss Rahsaan Heaney IV","nickname":"qui","email":"[email protected]","birthdate":"1995-11-27 00:00:00","gender":"F","salary":"49003.00","group_id":2,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":24,"group":{"id":2,"name":"Exec","description":"Executives"},"address":{"id":5,"user_id":5,"line1":"91792 Kertzmann Prairie Apt. 376\nLake Nakiaville, DC 98189","line2":"Jamaica","zipcode":"10101-1450","mobile":"07507519787","fax":"+24(9)5120507985"}},
{"id":6,"name":"Ms. Crystel Zemlak IV","nickname":"reiciendis","email":"[email protected]","birthdate":"1968-09-12 00:00:00","gender":"F","salary":"12383.00","group_id":4,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":51,"group":{"id":4,"name":"Sup","description":"Supervisors"},"address":{"id":6,"user_id":6,"line1":"97650 Scot Haven Apt. 160\nCrawfordmouth, ME 39767-7003","line2":"Finland","zipcode":"88917","mobile":"1-851-069-9234x9566","fax":"(048)445-4691x33356"}},
{"id":7,"name":"Nona McDermott","nickname":"quaerat","email":"[email protected]","birthdate":"1985-10-01 00:00:00","gender":"F","salary":"18512.00","group_id":4,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":34,"group":{"id":4,"name":"Sup","description":"Supervisors"},"address":{"id":7,"user_id":7,"line1":"4332 Alvina Radial\nPort Darbyville, IA 63357","line2":"Barbados","zipcode":"79679","mobile":"(736)058-1324","fax":"002.234.8466x49816"}},
{"id":8,"name":"Miss Genoveva Murazik V","nickname":"rerum","email":"[email protected]","birthdate":"1988-10-19 00:00:00","gender":"F","salary":"31209.00","group_id":2,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":31,"group":{"id":2,"name":"Exec","description":"Executives"},"address":{"id":8,"user_id":8,"line1":"96418 Ritchie Mall Apt. 215\nLake Jessyca, VT 65970-8256","line2":"Netherlands Antilles","zipcode":"94649-6628","mobile":"472.825.7183","fax":"400-507-7463"}},
{"id":9,"name":"Beulah Huels","nickname":"non","email":"[email protected]","birthdate":"1963-09-04 00:00:00","gender":"F","salary":"36920.00","group_id":5,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":56,"group":{"id":5,"name":"Emp","description":"Employees"},"address":{"id":9,"user_id":9,"line1":"18890 Carroll Lakes Suite 355\nUptonchester, UT 94878-0739","line2":"Hong Kong","zipcode":"91204","mobile":"831.652.0832","fax":"(688)788-8947"}},
{"id":10,"name":"Zoe Klein","nickname":"ex","email":"[email protected]","birthdate":"1990-04-19 00:00:00","gender":"F","salary":"35616.00","group_id":3,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":29,"group":{"id":3,"name":"Mgr","description":"Managers"},"address":{"id":10,"user_id":10,"line1":"6721 Nader Summit\nLake Alana, MS 84476","line2":"Reunion","zipcode":"77124-1459","mobile":"1-129-438-6148","fax":"(913)441-3846"}},
{"id":11,"name":"Vickie Kiehn","nickname":"assumenda","email":"[email protected]","birthdate":"1988-04-20 00:00:00","gender":"F","salary":"30790.00","group_id":3,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":31,"group":{"id":3,"name":"Mgr","description":"Managers"},"address":{"id":11,"user_id":11,"line1":"763 McCullough Ville\nNew Thomasstad, HI 64611","line2":"Oman","zipcode":"00642","mobile":"1-296-172-2126x275","fax":"(559)203-8694"}},
{"id":12,"name":"Elwyn Herzog","nickname":"praesentium","email":"[email protected]","birthdate":"1990-01-22 00:00:00","gender":"M","salary":"35785.00","group_id":1,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":29,"group":{"id":1,"name":"Admin","description":"Administrators"},"address":{"id":12,"user_id":12,"line1":"65641 Baron Spurs Suite 988\nNorth Ivah, IA 92235","line2":"Nepal","zipcode":"90316-7411","mobile":"064.482.9432x9456","fax":"05936098280"}},
{"id":13,"name":"Selena Hettinger","nickname":"et","email":"[email protected]","birthdate":"1981-10-01 00:00:00","gender":"F","salary":"31836.00","group_id":5,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":38,"group":{"id":5,"name":"Emp","description":"Employees"},"address":{"id":13,"user_id":13,"line1":"42272 Stoltenberg Points Suite 006\nLake Dustin, NH 70213-2043","line2":"Uganda","zipcode":"60996-2982","mobile":"(508)122-5892","fax":"356-682-2023x07379"}},
{"id":14,"name":"Edwin Beier","nickname":"eos","email":"[email protected]","birthdate":"1978-10-13 00:00:00","gender":"M","salary":"11902.00","group_id":1,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":41,"group":{"id":1,"name":"Admin","description":"Administrators"},"address":{"id":14,"user_id":14,"line1":"362 Trantow Loop Apt. 150\nLake Marafurt, DC 27926","line2":"Gabon","zipcode":"36943-1099","mobile":"033-386-4972x26066","fax":"1-363-037-1381"}},
{"id":15,"name":"Lexi Braun MD","nickname":"autem","email":"[email protected]","birthdate":"1971-12-07 00:00:00","gender":"F","salary":"11927.00","group_id":4,"created_at":"2017-01-01 07:21:10","updated_at":"2017-01-01 07:21:10","age":47,"group":{"id":4,"name":"Sup","description":"Supervisors"},"address":{"id":15,"user_id":15,"line1":"6737 Schimmel Crossing Suite 720\nShieldsberg, AK 44558","line2":"Tanzania","zipcode":"75615","mobile":"338.920.3112","fax":"(467)912-6668"}}
],
};
},
watch: {
data(newVal, oldVal) {
this.$refs.vuetable.refresh();
}
},
methods: {
onPaginationData: function(paginationData) {
console.log(paginationData);
this.$refs.pagination.setPaginationData(paginationData)
},
onChangePage(page) {
this.$refs.vuetable.changePage(page);
},
dataManager: function(sortOrder, pagination) {
if (this.localData.length < 1) return;
let local = this.localData;
pagination = this.$refs.vuetable.makePagination(
local.length,
this.perPage
);
console.log('pagination:', pagination)
let from = pagination.from - 1;
let to = from + this.perPage;
return {
pagination: pagination,
data: local.slice(from, to)
};
},
onLoading:function() {
console.log('loading... show your spinner here')
},
onLoaded:function() {
console.log('loaded! .. hide your spinner here')
}
}
});
Also see: Tab Triggers