mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-24 19:39:27 +08:00
feat: 支持 uTools list 模板
This commit is contained in:
43
static/plugins/tpl/index.js
Normal file
43
static/plugins/tpl/index.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import doc from './doc.js';
|
||||
import list from './list.js';
|
||||
|
||||
function getQueryVariable(variable) {
|
||||
var query = window.location.search.substring(1);
|
||||
var vars = query.split("&");
|
||||
for (var i=0;i<vars.length;i++) {
|
||||
var pair = vars[i].split("=");
|
||||
if(pair[0] == variable){return pair[1];}
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
const routes = [
|
||||
{ path: '/doc', name: 'doc', component: doc },
|
||||
{ path: '/list', name: 'list', component: list },
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
routes
|
||||
})
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
config: window.exports,
|
||||
code: '',
|
||||
current: {},
|
||||
},
|
||||
mounted() {
|
||||
this.code = getQueryVariable('code');
|
||||
this.current = this.config[this.code];
|
||||
this.$router.push({
|
||||
name: this.current.mode,
|
||||
query: {
|
||||
args: JSON.stringify(this.current.args),
|
||||
rootPath: getQueryVariable('targetFile').replace('index.html', '')
|
||||
},
|
||||
})
|
||||
|
||||
},
|
||||
router,
|
||||
})
|
||||
Reference in New Issue
Block a user