create vue-link-formatter module, integrated home link fields into vuejs
This commit is contained in:
@@ -1204,16 +1204,6 @@ body {
|
||||
font-style: normal;
|
||||
line-height: 1.3; }
|
||||
|
||||
a.btn {
|
||||
display: inline-block;
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
padding: 0.7em 1em;
|
||||
margin-bottom: 0.3em;
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
border-radius: 5px; }
|
||||
|
||||
aside.messages {
|
||||
border: none; }
|
||||
|
||||
|
@@ -1190,7 +1190,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _default = {\n props: ['html'],\n // get the html from parent with props\n data: function data() {\n return {\n template: null // compiled template from html used in render\n\n };\n },\n beforeMount: function beforeMount() {\n var _this = this;\n\n // console.log('Home beforeMount');\n // compile the html src (coming from parent with props or from ajax call)\n if (this.html) {\n // console.log('html', this.html);\n this.template = _vue.default.compile(this.html);\n this.$options.staticRenderFns = [];\n this._staticTrees = [];\n this.template.staticRenderFns.map(function (fn) {\n return _this.$options.staticRenderFns.push(fn);\n });\n }\n },\n render: function render(h) {\n if (!this.template) {\n return h('span', 'Loading ...');\n } else {\n return this.template.render.call(this);\n }\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack://materio.com/./web/themes/custom/materiotheme/vuejs/components/Pages/Home.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
||||
eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _default = {\n props: ['html'],\n // get the html from parent with props\n data: function data() {\n return {\n template: null // compiled template from html used in render\n\n };\n },\n beforeMount: function beforeMount() {\n var _this = this;\n\n // console.log('Home beforeMount');\n // compile the html src (coming from parent with props or from ajax call)\n if (this.html) {\n // console.log('html', this.html);\n this.template = _vue.default.compile(this.html);\n this.$options.staticRenderFns = [];\n this._staticTrees = [];\n this.template.staticRenderFns.map(function (fn) {\n return _this.$options.staticRenderFns.push(fn);\n });\n }\n },\n render: function render(h) {\n if (!this.template) {\n return h('span', 'Loading ...');\n } else {\n return this.template.render.call(this);\n }\n },\n methods: {\n onClickLink: function onClickLink(e) {\n console.log(\"onClickLink\", e, this.$router);\n var path = null;\n this.$router.options.routes.forEach(function (route) {\n // console.log('route.path', route.path);\n if (route.path == e.originalTarget.pathname) {\n path = e.originalTarget.pathname; // TODO: check if path is current\n // TODO: as we can't break forEach is not the good method here\n }\n }, this);\n\n if (path) {\n this.$router.push({\n path: path\n });\n }\n }\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack://materio.com/./web/themes/custom/materiotheme/vuejs/components/Pages/Home.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
@@ -5,13 +5,3 @@ body{
|
||||
font-style: normal;
|
||||
line-height: 1.3;
|
||||
}
|
||||
a.btn{
|
||||
display: inline-block;
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
padding: 0.7em 1em;
|
||||
margin-bottom: 0.3em;
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
@@ -26,6 +26,27 @@ export default {
|
||||
}else{
|
||||
return this.template.render.call(this)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickLink(e){
|
||||
console.log("onClickLink", e, this.$router);
|
||||
let path = null;
|
||||
|
||||
this.$router.options.routes.forEach(route => {
|
||||
// console.log('route.path', route.path);
|
||||
if (route.path == e.originalTarget.pathname) {
|
||||
path = e.originalTarget.pathname
|
||||
// TODO: check if path is current
|
||||
// TODO: as we can't break forEach is not the good method here
|
||||
}
|
||||
}, this)
|
||||
|
||||
if (path) {
|
||||
this.$router.push({
|
||||
path: path
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user